MONGOC_CURSOR_SET_LIMIT(3)
β¨ MONGOC_CURSOR_SET_LIMIT(3) β¨
okay bestie, welcome to the libmongoc manual page for mongoc_cursor_set_limit β she's giving "small function, big personality" and honestly? iconic π
πΈ SYNOPSIS πΈ
bool
mongoc_cursor_set_limit (mongoc_cursor_t *cursor, int64_t limit);
π PARAMETERS π
cursorβ amongoc_cursor_t. your main character β¨limitβ the maximum number of documents to retrieve for this query. signed, so she can go negative too π
π¦ DESCRIPTION π¦
So what does she do? She limits the number of documents in the result set. That's the whole vibe. π
This function is genuinely so useful for setting the limit on a cursor after the cursor is created, but before any calls to mongoc_cursor_next(). Lowkey the perfect little window to slide in and set your limit π
It can also be used to pass a negative limit β yes bestie, the limit parameter to mongoc_cursor_set_limit is signed, so negatives are fair game π
β οΈ Calling this function after mongoc_cursor_next() has no effect. she's done listening at that point, fr fr π
And here's the tea: this is not applicable to all cursors π Calling mongoc_cursor_set_limit() on a cursor returned by mongoc_client_find_databases_with_opts(), mongoc_database_find_collections_with_opts(), or mongoc_collection_find_indexes_with_opts() will not change the results. like, at all. she simply doesn't apply there π§
π RETURNS π
Returns true on success. If any arguments are invalid, returns false and leaves the limit unchanged β no funny business, she keeps the original value π«Ά
π AUTHOR π
MongoDB, Inc
β COPYRIGHT β
2009-present, MongoDB, Inc.
and that's the whole page, bestie! π ngl she's short but she ate β¨ remember: set your limit before the mongoc_cursor_next() calls, keep it signed, and don't come for the database-listing cursors because they're not playing that game π
this cute little sign-off is version 2.5.6, dated Oct 09, 2026, straight from libmongoc β MONGOC_CURSOR_SET_LIMIT(3), slay π
πΈ
π¦ 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