MONGOC_CLIENT_SET_WRITE_CONCERN(3)

πŸ’… MONGOC_CLIENT_SET_WRITE_CONCERN πŸ’…

okay bestie, so this one lives in libmongoc (that's the C driver for MongoDB, iykyk) and it's literally about how sure you wanna be that your writes actually, you know, landed. no cap, it's a good one.


✨ SYNOPSIS ✨

void
mongoc_client_set_write_concern (mongoc_client_t *client,
                                 const mongoc_write_concern_t *write_concern);

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function sets the write concern for the client. that's it, that's the whole vibe. πŸŽ€

key thing tho: it only affects future operations, collections, and databases that inherit from the client. it's giving "no take-backs", it does not retroactively fix stuff you already did. πŸ™ˆ

the default write concern is MONGOC_WRITE_CONCERN_W_DEFAULT β€” and what that means is the driver blocks, just sitting there waiting for basic acknowledgement of write operations from MongoDB. so you write something, you wait for MongoDB to be like "yeah got it", and then you move on. for the great majority of applications, this is literally the correct write concern. like, the correct one. don't overthink it, bestie. πŸ‘‘

⚠️ okay this part matters: it is a programming error to call this function on a client that came from a mongoc_client_pool_t. like, don't. for pooled clients you set the write concern with the MongoDB URI instead. periodt. πŸ’€

🌸 PARAMETERS 🌸

  • client β€” a mongoc_client_t. the main character here. πŸ’–
  • write_concern β€” a mongoc_write_concern_t. the level of "how sure are we tho" you wanna hand off. ✨

🫢 AUTHOR 🫢

MongoDB, Inc β€” the icons who brought you this whole thing.

2009-present, MongoDB, Inc. (yes, they've been at it since 2009, respect.)


so yeah, that's the whole page, bestie 🌈 β€” libmongoc version 2.5.6, dated Oct 09 (the year's cut off at the edge of the page, hotpink tragedy 😭), and that's a wrap, mwah πŸ’œ

πŸ“¦ where this page comes from