table of contents
MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY(3) | Library Functions Manual | MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY(3) |
NAME¶
mongoc_cursor_new_from_command_reply() - Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command:SYNOPSIS¶
mongoc_cursor_t * mongoc_cursor_new_from_command_reply (mongoc_client_t *client, bson_t *reply, uint32_t server_id);
PARAMETERS¶
- 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 and must not be accessed afterward.
- server_id
- The opaque id of the server used to execute the command.
DESCRIPTION¶
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 is a low‐level function that initializes a mongoc_cursor_t from such a reply.
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.
RETURNS¶
A mongoc_cursor_t mongoc_cursor_errorCOLOPHON¶
This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.2016‐10‐12 | MongoDB C Driver |