1MONGOC_CURSOR_NEW_FROM_COMMAND_REPLYl(i3b)moMnOgNoGcOC_CURSOR_NEW_FROM_COMMAND_REPLY(3)
2
3
4
6 mongoc_cursor_new_from_command_reply - mongoc_cursor_new_from_com‐
7 mand_reply()
8
10 mongoc_cursor_t *
11 mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
12 bson_t *reply,
13 uint32_t server_id);
14 BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts);
15
17 This function is deprecated and should not be used in new code.
18
19 Please use mongoc_cursor_new_from_command_reply_with_opts() instead.
20
21 When migrating from the deprecated
22 mongoc_cursor_new_from_command_reply() to
23 mongoc_cursor_new_from_command_reply_with_opts(), note that options
24 previously passed to the reply argument (e.g. "batchSize") must instead
25 be provided in the opts argument.
26
28 • client: A mongoc_client_t.
29
30 • reply: The reply to a command, such as "aggregate", "find", or "list‐
31 Collections", that returns a cursor document. The reply is destroyed
32 by mongoc_cursor_new_from_command_reply and must not be accessed af‐
33 terward.
34
35 • server_id: The opaque id of the server used to execute the command.
36
38 Some MongoDB commands return a "cursor" document. For example, given an
39 "aggregate" command:
40
41 { "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
42
43 The server replies:
44
45 {
46 "cursor" : {
47 "id" : 1234,
48 "ns" : "db.collection",
49 "firstBatch" : [ ]
50 },
51 "ok" : 1
52 }
53
54 mongoc_cursor_new_from_command_reply is a low-level function that ini‐
55 tializes a mongoc_cursor_t from such a reply. Additional options such
56 as "tailable" or "awaitData" can be included in the reply.
57
58 When synthesizing a completed cursor response that has no more batches
59 (i.e. with cursor id 0), set server_id to 0 as well.
60
61 Use this function only for building a language driver that wraps the C
62 Driver. When writing applications in C, higher-level functions such as
63 mongoc_collection_aggregate() are more appropriate, and ensure compati‐
64 bility with a range of MongoDB versions.
65
67 A mongoc_cursor_t. On failure, the cursor's error is set. Check for
68 failure with mongoc_cursor_error().
69
71 MongoDB, Inc
72
74 2017-present, MongoDB, Inc
75
76
77
78
791.23.1 Oct 20,MO2N0G2O2C_CURSOR_NEW_FROM_COMMAND_REPLY(3)