GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY_WITH_OPTS(3) libmongoc MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY_WITH_OPTS(3)

mongoc_cursor_t *
mongoc_cursor_new_from_command_reply_with_opts (mongoc_client_t *client,

bson_t *reply,
const bson_t *opts);


  • client: A mongoc_client_t.
  • reply: The reply to a command, such as "aggregate", "find", or "listCollections", that returns a cursor document. The reply is destroyed by mongoc_cursor_new_from_command_reply_with_opts and must not be accessed afterward.
  • opts: A bson_t.

opts may be NULL or a BSON document with additional options, which have the same meaning for this function as for mongoc_collection_find_with_opts():

  • awaitData
  • batchSize
  • limit
  • maxAwaitTimeMS
  • serverId
  • sessionId
  • skip
  • tailable

Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command:

{ "aggregate" : "collection", "pipeline" : [], "cursor" : {}}


The server replies:

{

"cursor" : {
"id" : 1234,
"ns" : "db.collection",
"firstBatch" : [ ]
},
"ok" : 1 }


mongoc_cursor_new_from_command_reply_with_opts is a low-level function that initializes a mongoc_cursor_t from such a reply.

When synthesizing a completed cursor response that has no more batches (i.e. with cursor id 0), serverId may be 0. If the cursor response is not completed (i.e. with non-zero cursor id), pass the serverId of the server used to create the cursor.

Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions such as mongoc_collection_aggregate() are more appropriate, and ensure compatibility with a range of MongoDB versions.

A mongoc_cursor_t. On failure, the cursor's error is set. Check for failure with mongoc_cursor_error().

MongoDB, Inc

2009-present, MongoDB, Inc.

July 3, 2025 1.30.4

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.