1MONGOC_CURSOR_SET_LIMIT(3) libmongoc MONGOC_CURSOR_SET_LIMIT(3)
2
3
4
6 bool
7 mongoc_cursor_set_limit (mongoc_cursor_t *cursor, int64_t limit);
8
10 • cursor: A mongoc_cursor_t.
11
12 • limit: The maximum number of documents to retrieve for this query.
13
15 Limits the number of documents in the result set.
16
17 This function is useful for setting the limit on a cursor after the
18 cursor is created, but before any calls to mongoc_cursor_next(). It can
19 also be used to pass a negative limit: The limit parameter to mon‐
20 goc_cursor_set_limit is signed, although for backward-compatibility
21 reasons the limit parameter to mongoc_collection_find() is not.
22
23 Calling this function after mongoc_cursor_next() has no effect.
24
25 This is not applicable to all cursors. Calling
26 mongoc_cursor_set_limit() on a cursor returned by
27 mongoc_client_find_databases_with_opts(),
28 mongoc_database_find_collections_with_opts(), or
29 mongoc_collection_find_indexes_with_opts() will not change the results.
30
32 Returns true on success. If any arguments are invalid, returns false
33 and leaves the limit unchanged.
34
36 MongoDB, Inc
37
39 2017-present, MongoDB, Inc
40
41
42
43
441.25.1 Nov 08, 2023 MONGOC_CURSOR_SET_LIMIT(3)