1MONGOC_DATABASE_COMMAND(3) libmongoc MONGOC_DATABASE_COMMAND(3)
2
3
4
6 mongoc_database_command - mongoc_database_command()
7
9 mongoc_cursor_t *
10 mongoc_database_command (mongoc_database_t *database,
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_database_command_with_opts(),
21 mongoc_database_read_command_with_opts(),
22 mongoc_database_write_command_with_opts(), and
23 mongoc_database_read_write_command_with_opts().
24
26 This function creates a cursor which will execute the command when
27 mongoc_cursor_next() is called on it. The database's read preference,
28 read concern, and write concern are not applied to the command, and
29 mongoc_cursor_next() will not check the server response for a write
30 concern error or write concern timeout.
31
32 This function is not considered a retryable read operation.
33
35 • database: A mongoc_database_t.
36
37 • flags: A mongoc_query_flags_t.
38
39 • skip: The number of documents to skip on the server.
40
41 • limit: The maximum number of documents to return from the cursor.
42
43 • batch_size: Attempt to batch results from the server in groups of
44 batch_size documents.
45
46 • command: A bson_t containing the command.
47
48 • fields: An optional bson_t containing the fields to return. NULL for
49 all fields.
50
51 • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command
52 uses mode MONGOC_READ_PRIMARY.
53
55 This function returns a newly allocated mongoc_cursor_t that should be
56 freed with mongoc_cursor_destroy() when no longer in use. The returned
57 mongoc_cursor_t is never NULL, even on error. The user must call
58 mongoc_cursor_next() on the returned mongoc_cursor_t to execute the
59 initial command.
60
61 Cursor errors can be checked with mongoc_cursor_error_document(). It
62 always fills out the bson_error_t if an error occurred, and optionally
63 includes a server reply document if the error occurred server-side.
64
65 WARNING:
66 Failure to handle the result of this function is a programming er‐
67 ror.
68
70 MongoDB, Inc
71
73 2017-present, MongoDB, Inc
74
75
76
77
781.23.1 Oct 20, 2022 MONGOC_DATABASE_COMMAND(3)