MONGOC_CURSOR_SET_BATCH_SIZE(3)

✨ MONGOC_CURSOR_SET_BATCH_SIZE(3) ✨

okay bestie, quick vibe check: this is a page from the libmongoc manual, and it's about making your cursor chill out and fetch stuff in nicer little bundles instead of one giant chaotic dump. slay. πŸ’…


🌸 SYNOPSIS 🌸

void
mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor, uint32_t batch_size);

πŸŽ€ PARAMETERS πŸŽ€

  • cursor β€” a mongoc_cursor_t. your lil cursor guy. the main character fr. πŸ‘‘
  • batch_size β€” the requested number of documents per batch. like, how many besties you're willing to bring in per trip. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea πŸ’–: this function limits the number of documents returned in one batch. and why do we care? because every single batch means a whole round trip to the server β€” literally a whole commute 😭 β€” so this is how you control how much you're picking up each time you go.

If batch_size is zero, the cursor just uses the server-defined maximum batch size. no thoughts, just vibes, let the server decide. ✨

Also, check out Cursor Batches in the MongoDB Manual for the full lore. iykyk πŸ“š

πŸ™ˆ real talk though β€” this is not applicable to all cursors. if you call mongoc_cursor_set_batch_size() on a cursor that came back from mongoc_client_find_databases_with_opts(), mongoc_database_find_collections_with_opts(), or mongoc_collection_find_indexes_with_opts(), it will not change the results. like at all. zero effect. it's giving "talking to a wall" πŸ’€ so don't come for this function when nothing happens, okay?

πŸ’œ AUTHOR πŸ’œ

MongoDB, Inc β€” icons only. πŸŽ€


2009-present, MongoDB, Inc. periodt. πŸ’…


and that's the whole page bestie, no cap! πŸ¦‹ this was version 2.5.6 of the manual, dated Oct 09, 2026, and it ate, honestly. go forth and batch responsibly βœ¨πŸ“πŸ’–

πŸ“¦ where this page comes from