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