MONGOC_STREAM_WRITE(3)

πŸ’… MONGOC_STREAM_WRITE(3) ✨

okay so bestie, this is a libmongoc page, and honestly it's a short one but it's important, so let's get into it 🫢


🌸 SYNOPSIS 🌸

like, here's the whole vibe, literally copy this exactly:

ssize_t
mongoc_stream_write (mongoc_stream_t *stream,
                     void *buf,
                     size_t count,
                     int32_t timeout_msec);

πŸŽ€ PARAMETERS πŸŽ€

  • stream β€” a mongoc_stream_t. that's the thing you're writing into, bestie πŸ’–
  • buf β€” the buffer to write. this is where your bytes are living rn.
  • count β€” the number of bytes to write. how many, diva.
  • timeout_msec β€” the number of milliseconds to wait before failure. and listen: a timeout of 0 will not block (iconic, zero patience energy). if it's negative, use the default timeout.

so basically the mongoc_stream_write() function shall perform a write to a mongoc_stream_t. it's modeled on the API and semantics of write(), though the parameters map only loosely β€” like, they're cousins, not twins, iykyk 😭

⚠️ WARNING bestie, read this: the "default timeout" indicated by a negative value is both unspecified and unrelated to the documented default values for *TimeoutMS URI options. so do not go assuming things. to specify a default timeout value for a *TimeoutMS URI option, use the MONGOC_DEFAULT_* constants defined in mongoc-client.h. periodt πŸ’…

⭐ RETURNS ⭐

the mongoc_stream_write() function returns the number of bytes written on success. it returns -1 and sets errno upon failure. no cap, that's it πŸ”₯

SEE ALSO:

  • mongoc_stream_read()
  • mongoc_stream_readv()
  • mongoc_stream_writev()

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


and that's the whole page, bestie, you ate πŸ“ this one's from version 2.5.6, dated Oct 09, 2026 β€” mwah, go write some bytes πŸ’œπŸ§š

πŸ“¦ where this page comes from