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
9 WARNING:
10 Deprecated since version 1.11.0: This function is deprecated and
11 should not be used in new code.
12
13 Please use mongoc_cursor_new_from_command_reply_with_opts() in new
14 code.
15
16 When migrating from the deprecated
17 mongoc_cursor_new_from_command_reply() to
18 mongoc_cursor_new_from_command_reply_with_opts(), note that options
19 previously passed to the reply argument (e.g. "batchSize") must in‐
20 stead be provided in the opts argument.
21
22
24 mongoc_cursor_t *
25 mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
26 bson_t *reply,
27 uint32_t server_id);
28 BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts);
29
31 • client: A mongoc_client_t.
32
33 • reply: The reply to a command, such as "aggregate", "find", or "list‐
34 Collections", that returns a cursor document. The reply is destroyed
35 by mongoc_cursor_new_from_command_reply and must not be accessed af‐
36 terward.
37
38 • server_id: The opaque id of the server used to execute the command.
39
41 Some MongoDB commands return a "cursor" document. For example, given an
42 "aggregate" command:
43
44 { "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
45
46 The server replies:
47
48 {
49 "cursor" : {
50 "id" : 1234,
51 "ns" : "db.collection",
52 "firstBatch" : [ ]
53 },
54 "ok" : 1
55 }
56
57 mongoc_cursor_new_from_command_reply is a low-level function that ini‐
58 tializes a mongoc_cursor_t from such a reply. Additional options such
59 as "tailable" or "awaitData" can be included in the reply.
60
61 When synthesizing a completed cursor response that has no more batches
62 (i.e. with cursor id 0), server_id may be 0. If the cursor response is
63 not completed (i.e. with non-zero cursor id), pass the server_id of the
64 server used to create the cursor.
65
66 Use this function only for building a language driver that wraps the C
67 Driver. When writing applications in C, higher-level functions such as
68 mongoc_collection_aggregate() are more appropriate, and ensure compati‐
69 bility with a range of MongoDB versions.
70
72 A mongoc_cursor_t. On failure, the cursor's error is set. Check for
73 failure with mongoc_cursor_error().
74
76 MongoDB, Inc
77
79 2017-present, MongoDB, Inc
80
81
82
83
841.24.3 Aug 17,MO2N0G2O3C_CURSOR_NEW_FROM_COMMAND_REPLY(3)