1MONGOC_COLLECTION_COMMAND(3) libmongoc MONGOC_COLLECTION_COMMAND(3)
2
3
4
6 mongoc_collection_command - mongoc_collection_command()
7
9 mongoc_cursor_t *
10 mongoc_collection_command (mongoc_collection_t *collection,
11 mongoc_query_flags_t flags,
12 uint32_t skip,
13 uint32_t limit,
14 uint32_t batch_size,
15 const bson_t *command,
16 const bson_t *fields,
17 const mongoc_read_prefs_t *read_prefs)
18 BSON_GNUC_WARN_UNUSED_RESULT;
19
20 This function is superseded by mongoc_collection_command_with_opts(),
21 mongoc_collection_read_command_with_opts(),
22 mongoc_collection_write_command_with_opts(), and
23 mongoc_collection_read_write_command_with_opts().
24
25 This function is not considered a retryable read operation.
26
28 • collection: A mongoc_collection_t.
29
30 • flags: A mongoc_query_flags_t.
31
32 • skip: A uint32_t with the number of documents to skip or zero.
33
34 • limit: A uint32_t with the max number of documents to return or zero.
35
36 • batch_size: A uint32_t with the number of documents in each batch or
37 zero. Default is 100.
38
39 • command: A bson_t containing the command to execute.
40
41 • fields: A bson_t containing the fields to return or NULL. Not all
42 commands support this option.
43
44 • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command
45 uses mode MONGOC_READ_PRIMARY.
46
48 This function returns a newly allocated mongoc_cursor_t that should be
49 freed with mongoc_cursor_destroy() when no longer in use. The returned
50 mongoc_cursor_t is never NULL, even on error. The user must call
51 mongoc_cursor_next() on the returned mongoc_cursor_t to execute the
52 initial command.
53
54 Cursor errors can be checked with mongoc_cursor_error_document(). It
55 always fills out the bson_error_t if an error occurred, and optionally
56 includes a server reply document if the error occurred server-side.
57
58 WARNING:
59 Failure to handle the result of this function is a programming er‐
60 ror.
61
63 MongoDB, Inc
64
66 2017-present, MongoDB, Inc
67
68
69
70
711.23.1 Oct 20, 2022 MONGOC_COLLECTION_COMMAND(3)