MONGOC_CURSOR..._AWAIT_TIME_MS(3)
π MONGOC_CURSOR_SET_MAX_AWAIT_TIME_MS(3) π
okay bestie, so this is a page out of libmongoc and it's all about telling your tailable cursor how long the server should sit there and wait for new docs to show up. lowkey niche but highkey useful, iykyk π¦
β¨ SYNOPSIS β¨
void
mongoc_cursor_set_max_await_time_ms (mongoc_cursor_t *cursor,
uint32_t max_await_time_ms);
π PARAMETERS π
cursorβ amongoc_cursor_t. the main character of this whole situation, fr fr.max_await_time_msβ a timeout in milliseconds. that's it, that's the number. π«
π DESCRIPTION π
so here's the vibe: this sets the maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. the server just hangs out patiently like a good little guy until it gets what it needs or the clock runs out. β³
it only applies if the cursor was created from mongoc_collection_find_with_opts() with the "tailable" and "awaitData" options, and the server is MongoDB 3.2 or later. no cap, both conditions. π«Ά
peep the documentation for maxTimeMS and the "getMore" command if you wanna go deeper. π
bestie, listen to me: themax_await_time_mscannot be changed after the first call tomongoc_cursor_next(). so set it up before you start pulling docs, okay? π
also β and this is the part people miss β this is not applicable to all cursors. calling mongoc_cursor_set_batch_size() on a cursor returned by any of these:
mongoc_client_find_databases_with_opts()mongoc_database_find_collections_with_opts()mongoc_collection_find_indexes_with_opts()
...will not change the results. like, nothing. zero. nada. π
Note: althoughmax_await_time_msis auint32_t, it is possible to set it as auint64_tthrough the options arguments in some cursor returning functions likemongoc_collection_find_with_opts(). type chaos, but make it β¨intentionalβ¨.
π SEE ALSO π
Tailable Cursors. (go read it, it's giving required reading π )
π AUTHOR π
MongoDB, Inc
β COPYRIGHT β
2009-present, MongoDB, Inc.
alright that's the whole page, mwah π if you made it this far then you're officially a tailable cursor girlie now. this was libmongoc version 2.5.6, dated Oct 09, 2026 β slay, periodt. ππ¦πΈ
π¦ 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