1MONGOC_COLLECTION_DELETE_ONE(3)    libmongoc   MONGOC_COLLECTION_DELETE_ONE(3)
2
3
4

NAME

6       mongoc_collection_delete_one - mongoc_collection_delete_one()
7

SYNOPSIS

9          bool
10          mongoc_collection_delete_one (mongoc_collection_t *collection,
11                                        const bson_t *selector,
12                                        const bson_t *opts,
13                                        bson_t *reply,
14                                        bson_error_t *error);
15

PARAMETERS

17collection: A mongoc_collection_t.
18
19selector: A bson_t containing the query to match documents.
20
21reply:  Optional.  An  uninitialized bson_t populated with the delete
22         result, or NULL.
23
24error: 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
28writeConcern:  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
32sessionId:  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
39validate:     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
43collation:  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
47hint: A document or string that specifies the index to use to support
48         the query predicate.
49

DESCRIPTION

51       This function removes at most one document in the given collection that
52       matches selector.
53
54       To delete all matching documents, use mongoc_collection_delete_many.
55
56       If you pass a non-NULL reply, it is filled out with the field "deleted‐
57       Count". If there is  a  server  error  then  reply  contains  either  a
58       "writeErrors"  array with one subdocument or a "writeConcernErrors" ar‐
59       ray. The reply must be freed with bson_destroy().
60

ERRORS

62       Errors are propagated via the error parameter.
63

RETURNS

65       Returns true if successful. Returns false and sets error if  there  are
66       invalid arguments or a server or network error.
67

AUTHOR

69       MongoDB, Inc
70
72       2017-present, MongoDB, Inc
73
74
75
76
771.21.1                           Mar 02, 2022  MONGOC_COLLECTION_DELETE_ONE(3)
Impressum