MONGOC_COLLEC...DIFY_WITH_OPTS(3)
okay bestie, this is the mongoc_collection_find_and_modify_with_opts() page from libmongoc β yes, the header is out here doing MONGOC_COLLEC...DIFY_WITH_OPTS(3) and it's iconic π
β¨
β¨ SYNOPSIS β¨
here's the signature in all its glory, copy it exactly fr fr:
bool
mongoc_collection_find_and_modify_with_opts (
mongoc_collection_t *collection,
const bson_t *query,
const mongoc_find_and_modify_opts_t *opts,
bson_t *reply,
bson_error_t *error);
π«Ά PARAMETERS π«Ά
collectionβ amongoc_collection_t, aka the collection in question πqueryβ abson_tcontaining the query to locate target document(s) πoptsβ a find and modify options. Must not beNULL. periodt.replyβ a maybe-NULLpointer to overwritable storage for abson_tto contain the results πerrorβ an optional location for abson_error_t, orNULLπ«Ά
πΈ DESCRIPTION πΈ
Update and return an object. That's the whole assignment, and it ate π
reply is always initialized, and it must be freed with bson_destroy() β no skipping that, bestie.
If an unacknowledged write concern is set (through mongoc_find_and_modify_opts_append()), the output reply is always an empty document. Lowkey crucial.
On success, the output reply contains the full server reply to the findAndModify command. For the expected server reply, see the MongoDB Manual page for findAndModify β that's the reference, fr fr.
π ERRORS π
Errors are propagated via the error parameter. That's the tea β
π₯ RETURNS π₯
Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error β vibe check failed, basically.
A write concern timeout or write concern error is considered a failure. No cap.
π¦ EXAMPLE π¦
See the example code for mongoc_find_and_modify_opts_t. Go look, bestie π
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
kiss kiss, this page is from libmongoc version 2.5.6, dated Oct 09, 2026 β stay iconic, and may your reply always be initialized πβ¨
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms