1MONGOC_COLLECTION_REPLACE_ONE(3)   libmongoc  MONGOC_COLLECTION_REPLACE_ONE(3)
2
3
4

NAME

6       mongoc_collection_replace_one - mongoc_collection_replace_one()
7

SYNOPSIS

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

PARAMETERS

18       · collection: A mongoc_collection_t.
19
20       · selector:  A  bson_t  containing  the query to match the document for
21         updating.
22
23       · replacement: A bson_t containing the replacement document.
24
25       · reply: Optional. An uninitialized bson_t populated  with  the  update
26         result, or NULL.
27
28       · error: An optional location for a bson_error_t or NULL.
29
30       opts may be NULL or a BSON document with additional command options:
31
32       · writeConcern:   Construct   a  mongoc_write_concern_t  and  use  mon‐
33         goc_write_concern_append to add the write concern to  opts.  See  the
34         example code for mongoc_client_write_command_with_opts.
35
36       · sessionId:  First,  construct  a  mongoc_client_session_t  with  mon‐
37         goc_client_start_session. You  can  begin  a  transaction  with  mon‐
38         goc_client_session_start_transaction, optionally with a mongoc_trans‐
39         action_opt_t that overrides the options  inherited  from  collection,
40         and  use mongoc_client_session_append to add the session to opts. See
41         the example code for mongoc_client_session_t.
42
43       · validate:    Construct    a     bitwise-or     of     all     desired
44         bson_validate_flags_t. Set to false to skip client-side validation of
45         the provided BSON documents.
46
47       · bypassDocumentValidation: Set to true to skip server-side schema val‐
48         idation of the provided BSON documents.
49
50       · collation:  Configure  textual  comparisons.  See  Setting  Collation
51         Order, and the MongoDB Manual entry on Collation. Collation  requires
52         MongoDB 3.2 or later, otherwise an error is returned.
53
54       · hint: A document or string that specifies the index to use to support
55         the query predicate.
56
57       · upsert: When true, creates a new document if no document matches  the
58         query.
59

DESCRIPTION

61       This function shall replace documents in collection that match selector
62       with replacement.
63
64       If provided, reply will be initialized and populated  with  the  fields
65       matchedCount,  modifiedCount,  upsertedCount, and optionally upsertedId
66       if applicable. If there is a server error then reply contains either  a
67       writeErrors  array  with one subdocument or a writeConcernErrors array.
68       The reply must be freed with bson_destroy().
69

SEE ALSO

71       MongoDB update command documentation for more information on the update
72       options.
73
74       mongoc_collection_update_one mongoc_collection_update_many
75

ERRORS

77       Errors are propagated via the error parameter.
78

RETURNS

80       Returns  true  if successful. Returns false and sets error if there are
81       invalid arguments or a server or network error.
82
83       A write concern timeout or write concern error is considered a failure.
84

AUTHOR

86       MongoDB, Inc
87
89       2017-present, MongoDB, Inc
90
91
92
93
941.16.2                           Feb 25, 2020 MONGOC_COLLECTION_REPLACE_ONE(3)
Impressum