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
29 mongoc_write_concern_append() to add the write concern to opts. See
30 the example code for mongoc_client_write_command_with_opts().
31
32 • sessionId: First, construct a mongoc_client_session_t with
33 mongoc_client_start_session(). You can begin a transaction with
34 mongoc_client_session_start_transaction(), optionally with a
35 mongoc_transaction_opt_t that overrides the options inherited from
36 collection, and use mongoc_client_session_append() to add the session
37 to opts. See 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 • comment: A bson_value_t specifying the comment to attach to this com‐
44 mand. The comment will appear in log messages, profiler output, and
45 currentOp output. Requires MongoDB 4.4 or later.
46
47 • collation: Configure textual comparisons. See Setting Collation Or‐
48 der, and the MongoDB Manual entry on Collation. Collation requires
49 MongoDB 3.2 or later, otherwise an error is returned.
50
51 • hint: A document or string that specifies the index to use to support
52 the query predicate.
53
54 • let: A BSON document consisting of any number of parameter names,
55 each followed by definitions of constants in the MQL Aggregate Ex‐
56 pression language.
57
59 This function removes all documents in the given collection that match
60 selector.
61
62 To delete at most one matching document, use
63 mongoc_collection_delete_one().
64
65 If you pass a non-NULL reply, it is filled out with the field "deleted‐
66 Count". If there is a server error then reply contains either a
67 "writeErrors" array with one subdocument or a "writeConcernErrors" ar‐
68 ray. The reply must be freed with bson_destroy().
69
71 Errors are propagated via the error parameter.
72
74 Returns true if successful. Returns false and sets error if there are
75 invalid arguments or a server or network error.
76
78 MongoDB, Inc
79
81 2017-present, MongoDB, Inc
82
83
84
85
861.23.1 Oct 20, 2022 MONGOC_COLLECTION_DELETE_MANY(3)