1MONGOC_COLLECTION_DELETE_MANY(3) libmongoc MONGOC_COLLECTION_DELETE_MANY(3)
2
3
4
6 mongoc_collection_delete_many - mongoc_collection_delete_many()
7
9 bool
10 mongoc_collection_delete_many (mongoc_collection_t *collection,
11 const bson_t *selector,
12 const bson_t *opts,
13 bson_t *reply,
14 bson_error_t *error);
15
17 • collection: A mongoc_collection_t.
18
19 • selector: A bson_t containing the query to match documents.
20
21 • reply: Optional. An uninitialized bson_t populated with the delete
22 result, or NULL.
23
24 • error: An optional location for a bson_error_t or NULL.
25
26 opts may be NULL or a BSON document with additional command options:
27
28 • writeConcern: Construct a mongoc_write_concern_t and use mon‐
29 goc_write_concern_append to add the write concern to opts. See the
30 example code for mongoc_client_write_command_with_opts.
31
32 • sessionId: First, construct a mongoc_client_session_t with mon‐
33 goc_client_start_session. You can begin a transaction with mon‐
34 goc_client_session_start_transaction, optionally with a mongoc_trans‐
35 action_opt_t that overrides the options inherited from collection,
36 and use mongoc_client_session_append to add the session to opts. See
37 the example code for mongoc_client_session_t.
38
39 • validate: Construct a bitwise-or of all desired
40 bson_validate_flags_t. Set to false to skip client-side validation of
41 the provided BSON documents.
42
43 • collation: Configure textual comparisons. See Setting Collation Or‐
44 der, and the MongoDB Manual entry on Collation. Collation requires
45 MongoDB 3.2 or later, otherwise an error is returned.
46
47 • hint: A document or string that specifies the index to use to support
48 the query predicate.
49
51 This function removes all documents in the given collection that match
52 selector.
53
54 To delete at most one matching document, use mongoc_collec‐
55 tion_delete_one.
56
57 If you pass a non-NULL reply, it is filled out with the field "deleted‐
58 Count". If there is a server error then reply contains either a
59 "writeErrors" array with one subdocument or a "writeConcernErrors" ar‐
60 ray. The reply must be freed with bson_destroy().
61
63 Errors are propagated via the error parameter.
64
66 Returns true if successful. Returns false and sets error if there are
67 invalid arguments or a server or network error.
68
70 MongoDB, Inc
71
73 2017-present, MongoDB, Inc
74
75
76
77
781.20.0 Nov 18, 2021 MONGOC_COLLECTION_DELETE_MANY(3)