MONGOC_WRITE_CONCERN_SET_W(3)

✨ MONGOC_WRITE_CONCERN_SET_W ✨

okay bestie, so this is the mongoc_write_concern_set_w(3) page from libmongoc and it's honestly so much shorter than it sounds πŸ’– it does exactly one (1) thing and we're gonna obsess over it together.


🌸 SYNOPSIS 🌸

void
mongoc_write_concern_set_w (mongoc_write_concern_t *write_concern, int32_t w);

like, that's it. that's the whole function. void return, two args, no drama, no return value, no crumbs πŸŽ€


πŸ¦‹ PARAMETERS πŸ¦‹

  • write_concern β€” a mongoc_write_concern_t. yes. the write concern. the thing you're setting the w on. main character of the whole operation ngl πŸ‘‘
  • w β€” this is where it gets cute. you pass in one of:
    • MONGOC_WRITE_CONCERN_W_DEFAULT
    • MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED
    • MONGOC_WRITE_CONCERN_W_MAJORITY
    • or, like, a plain old positive integer. slay πŸ’…

πŸ’œ DESCRIPTION πŸ’œ

so what does it do? it sets the w value for the write concern. simple as that. if you want the whole deep lore on this setting, go check out mongoc_write_concern_t β€” it's the source, iykyk ✨

now the important part, bestie, listen up 🫢 β€” unacknowledged writes are not causally consistent. like, at all. if you run a write operation with a mongoc_write_concern_t where you've called mongoc_write_concern_set_w() with a value of MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED, then that write does not participate in causal consistency β€” even when you execute it with a mongoc_client_session_t. yes, even then. it's giving "i'm not part of the group chat" energy 😭

and here's the glow-up πŸ’€ β€” beginning in version 1.9.0, this function can actually alter the write concern after it's been used in an operation. before that? nope. using the struct with an operation would mark it as "frozen" and calling this function would just log a warning instead of altering the write concern. tragic. we don't miss those days πŸ™ˆ

ngl the "frozen" era was rough β€” if you're on something older than 1.9.0, expect a warning, not a change. just so you know πŸ’–

🧚 AUTHOR 🧚

MongoDB, Inc. β€” the icons themselves πŸ‘‘


2009-present, MongoDB, Inc. β€” periodt. no cap, fr fr πŸ’œ


and that's the pageeee πŸŽ€ mwah, go set some write concerns responsibly bestie ✨

libmongoc 2.5.6 Β· Oct 09, 2026 Β· MONGOC_WRITE_CONCERN_SET_W(3) πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from