1MONGOC_COLLECTION_COMMAND_WITH_OPTS(l3i)bmonMgOoNcGOC_COLLECTION_COMMAND_WITH_OPTS(3)
2
3
4

NAME

6       mongoc_collection_command_with_opts       -      mongoc_collection_com‐
7       mand_with_opts()
8

SYNOPSIS

10          bool
11          mongoc_collection_command_with_opts (
12             mongoc_collection_t *collection,
13             const bson_t *command,
14             const mongoc_read_prefs_t *read_prefs,
15             const bson_t *opts,
16             bson_t *reply,
17             bson_error_t *error);
18
19       Execute a command on the server, interpreting  opts  according  to  the
20       MongoDB server version. To send a raw command to the server without any
21       of this logic, use mongoc_client_command_simple().
22
23       Read preferences, read and write concern, and collation can be overrid‐
24       den  by various sources. The highest-priority sources for these options
25       are listed first:
26
27            ┌─────────────────┬──────────────┬───────────────┬───────────┐
28            │Read Preferences │ Read Concern │ Write Concern │ Collation │
29            ├─────────────────┼──────────────┼───────────────┼───────────┤
30read_prefs       opts         opts          opts      
31            ├─────────────────┼──────────────┼───────────────┼───────────┤
32            │Transaction      │ Transaction  │ Transaction   │           │
33            └─────────────────┴──────────────┴───────────────┴───────────┘
34
35       In a transaction, read concern and write concern are prohibited in opts
36       and  the  read preference must be primary or NULL.  See the example for
37       transactions and for the "distinct" command with opts.
38
39       reply is always initialized, and must be freed with bson_destroy().
40

PARAMETERS

42collection: A mongoc_collection_t.
43
44command: A bson_t containing the command specification.
45
46read_prefs: An optional mongoc_read_prefs_t.
47
48opts: A bson_t containing additional options.
49
50reply: A location for the resulting document.
51
52error: An optional location for a bson_error_t or NULL.
53
54       opts may be NULL or a BSON document with additional command options:
55
56readConcern:    Construct    a    mongoc_read_concern_t    and    use
57         mongoc_read_concern_append() to add the read concern to opts. See the
58         example code for mongoc_client_read_command_with_opts(). Read concern
59         requires MongoDB 3.2 or later, otherwise an error is returned.
60
61writeConcern:    Construct    a    mongoc_write_concern_t   and   use
62         mongoc_write_concern_append() to add the write concern to  opts.  See
63         the example code for mongoc_client_write_command_with_opts().
64
65sessionId:    First,   construct   a   mongoc_client_session_t   with
66         mongoc_client_start_session().  You  can  begin  a  transaction  with
67         mongoc_client_session_start_transaction(),    optionally    with    a
68         mongoc_transaction_opt_t that overrides the  options  inherited  from
69         collection, and use mongoc_client_session_append() to add the session
70         to opts. See the example code for mongoc_client_session_t.
71
72collation: Configure textual comparisons. See Setting  Collation  Or‐
73         der,  and  the  MongoDB Manual entry on Collation. Collation requires
74         MongoDB 3.2 or later, otherwise an error is returned.
75
76serverId: To target a specific server, include  an  int32  "serverId"
77         field.  Obtain  the id by calling mongoc_client_select_server(), then
78         mongoc_server_description_id() on its return value.
79
80       Consult the MongoDB Manual entry on Database  Commands  for  each  com‐
81       mand's arguments.
82
83       This function is not considered a retryable read operation.
84

ERRORS

86       Errors are propagated via the error parameter.
87

RETURNS

89       Returns  true  if successful. Returns false and sets error if there are
90       invalid arguments or a server or network error.
91
92       The reply is not parsed for a write concern timeout  or  write  concern
93       error.
94

EXAMPLE

96       See the example code for mongoc_client_read_command_with_opts().
97

AUTHOR

99       MongoDB, Inc
100
102       2017-present, MongoDB, Inc
103
104
105
106
1071.23.1                           Oct 20,M2O0N2G2OC_COLLECTION_COMMAND_WITH_OPTS(3)
Impressum