1MONGOC_CLIENT_READ_WRITE_COMMAND_WMIOTlNHiG_bOOmCPo_TnCSgL(oI3cE)NT_READ_WRITE_COMMAND_WITH_OPTS(3)
2
3
4

NAME

6       mongoc_client_read_write_command_with_opts            -            mon‐
7       goc_client_read_write_command_with_opts()
8

SYNOPSIS

10          bool
11          mongoc_client_read_write_command_with_opts (
12             mongoc_client_t *client,
13             const char *db_name,
14             const bson_t *command,
15             const mongoc_read_prefs_t *read_prefs /* UNUSED */,
16             const bson_t *opts,
17             bson_t *reply,
18             bson_error_t *error);
19
20       Execute a command on the server, applying logic for commands that  both
21       read  and write, and taking the MongoDB server version into account. To
22       send a raw command to  the  server  without  any  of  this  logic,  use
23       mongoc_client_command_simple().
24
25       Use  this  function  for  commands  that  both  read and write, such as
26       "mapReduce" with an output collection.
27
28       Read and write concern and  collation  can  be  overridden  by  various
29       sources.  In  a transaction, read concern and write concern are prohib‐
30       ited in opts. The highest-priority sources for these options are listed
31       first  in  the  following  table. Read preferences are not applied. The
32       write concern is omitted for MongoDB before 3.4.
33
34                     ┌─────────────┬───────────────┬───────────┐
35                     │Read Concern │ Write Concern │ Collation │
36                     ├─────────────┼───────────────┼───────────┤
37opts         opts          opts      
38                     ├─────────────┼───────────────┼───────────┤
39                     │Transaction  │ Transaction   │           │
40                     ├─────────────┼───────────────┼───────────┤
41client       client        │           │
42                     └─────────────┴───────────────┴───────────┘
43
44       See the example for transactions and for the  "distinct"  command  with
45       opts.
46
47       reply is always initialized, and must be freed with bson_destroy().
48
49       (The  mongoc_read_prefs_t  parameter  was included by mistake when this
50       function was introduced in libmongoc 1.5. A command  that  writes  must
51       not obey a read preference.)
52

PARAMETERS

54client: A mongoc_client_t.
55
56db_name: The name of the database to run the command on.
57
58command: A bson_t containing the command specification.
59
60read_prefs: Ignored.
61
62opts: A bson_t containing additional options.
63
64reply: A location for the resulting document.
65
66error: An optional location for a bson_error_t or NULL.
67
68       opts may be NULL or a BSON document with additional command options:
69
70readConcern:    Construct    a    mongoc_read_concern_t    and    use
71         mongoc_read_concern_append() to add the read concern to opts. See the
72         example code for mongoc_client_read_command_with_opts(). Read concern
73         requires MongoDB 3.2 or later, otherwise an error is returned.
74
75writeConcern:   Construct   a    mongoc_write_concern_t    and    use
76         mongoc_write_concern_append()  to  add the write concern to opts. See
77         the example code for mongoc_client_write_command_with_opts().
78
79sessionId:   First,   construct   a   mongoc_client_session_t    with
80         mongoc_client_start_session().  You  can  begin  a  transaction  with
81         mongoc_client_session_start_transaction(),    optionally    with    a
82         mongoc_transaction_opt_t  that  overrides  the options inherited from
83         client, and use mongoc_client_session_append() to add the session  to
84         opts. See the example code for mongoc_client_session_t.
85
86collation:  Configure  textual comparisons. See Setting Collation Or‐
87         der, and the MongoDB Manual entry on  Collation.  Collation  requires
88         MongoDB 3.2 or later, otherwise an error is returned.
89
90serverId:  To  target  a specific server, include an int32 "serverId"
91         field. Obtain the id by calling  mongoc_client_select_server(),  then
92         mongoc_server_description_id() on its return value.
93
94       Consult  the  MongoDB  Manual  entry on Database Commands for each com‐
95       mand's arguments.
96

ERRORS

98       Errors are propagated via the error parameter.
99

RETURNS

101       Returns true if successful. Returns false and sets error if  there  are
102       invalid arguments or a server or network error.
103
104       A write concern timeout or write concern error is considered a failure.
105

EXAMPLE

107       See the example code for mongoc_client_read_command_with_opts().
108

AUTHOR

110       MongoDB, Inc
111
113       2017-present, MongoDB, Inc
114
115
116
117
1181.23.1                           OMcOtNG2O0C,_C2L0I2E2NT_READ_WRITE_COMMAND_WITH_OPTS(3)
Impressum