1MONGOC_COLLECTION_UPDATE_MANY(3)MongoDB C DriverMONGOC_COLLECTION_UPDATE_MANY(3)
2
3
4
6 mongoc_collection_update_many - mongoc_collection_update_many()
7
9 bool
10 mongoc_collection_update_many (mongoc_collection_t *collection,
11 const bson_t *selector,
12 const bson_t *update,
13 const bson_t *opts,
14 bson_t *reply,
15 bson_error_t *error);
16
18 · collection: A mongoc_collection_t.
19
20 · selector: A bson_t containing the query to match documents for updat‐
21 ing.
22
23 · update: A bson_t containing the update to perform. If updating with a
24 pipeline, a bson_t array.
25
26 · reply: Optional. An uninitialized bson_t populated with the update
27 result, or NULL.
28
29 · error: An optional location for a bson_error_t or NULL.
30
31 opts may be NULL or a BSON document with additional command options:
32
33 · writeConcern: Construct a mongoc_write_concern_t and use mon‐
34 goc_write_concern_append to add the write concern to opts. See the
35 example code for mongoc_client_write_command_with_opts.
36
37 · sessionId: First, construct a mongoc_client_session_t with mon‐
38 goc_client_start_session. You can begin a transaction with mon‐
39 goc_client_session_start_transaction, optionally with a mongoc_trans‐
40 action_opt_t that overrides the options inherited from collection,
41 and use mongoc_client_session_append to add the session to opts. See
42 the example code for mongoc_client_session_t.
43
44 · validate: Construct a bitwise-or of all desired
45 bson_validate_flags_t. Set to false to skip client-side validation of
46 the provided BSON documents.
47
48 · bypassDocumentValidation: Set to true to skip server-side schema val‐
49 idation of the provided BSON documents.
50
51 · collation: Configure textual comparisons. See Setting Collation
52 Order, and the MongoDB Manual entry on Collation. Collation requires
53 MongoDB 3.2 or later, otherwise an error is returned.
54
55 · upsert: When true, creates a new document if no document matches the
56 query.
57
58 · arrayFilters: An array of filters specifying to which array elements
59 an update should apply.
60
62 This function updates all documents in collection that match selector.
63
64 To update at most one document see mongoc_collection_update_one.
65
66 If you pass a non-NULL reply, it is filled out with fields matched‐
67 Count, modifiedCount, and optionally upsertedId if applicable. If there
68 is a server error then reply contains either a "writeErrors" array with
69 one subdocument or a "writeConcernErrors" array. The reply must be
70 freed with bson_destroy().
71
73 MongoDB update command documentation for more information on the update
74 options.
75
76 mongoc_collection_update_one
77
79 Errors are propagated via the error parameter.
80
82 Returns true if successful. Returns false and sets error if there are
83 invalid arguments or a server or network error.
84
85 A write concern timeout or write concern error is considered a failure.
86
88 MongoDB, Inc
89
91 2017-present, MongoDB, Inc
92
93
94
95
961.15.2 Nov 06, 2019 MONGOC_COLLECTION_UPDATE_MANY(3)