1MONGOC_COLLECTION_DELETE_ONE(3)MongoDB C DriverMONGOC_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

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
44         Order, and the MongoDB Manual entry on Collation. Collation  requires
45         MongoDB 3.2 or later, otherwise an error is returned.
46

DESCRIPTION

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

ERRORS

59       Errors are propagated via the error parameter.
60

RETURNS

62       Returns  true  if successful. Returns false and sets error if there are
63       invalid arguments or a server or network error.
64

AUTHOR

66       MongoDB, Inc
67
69       2017-present, MongoDB, Inc
70
71
72
73
741.15.2                           Nov 06, 2019  MONGOC_COLLECTION_DELETE_ONE(3)
Impressum