1MONGOC_COLLECTION_FIND_INDEXES(3) libmongoc MONGOC_COLLECTION_FIND_INDEXES(3)
2
3
4
6 Deprecated since version 1.9.0: This function is deprecated and
7 should not be used in new code.
8
9 Please use mongoc_collection_find_indexes_with_opts() in new code.
10
11
13 mongoc_cursor_t *
14 mongoc_collection_find_indexes (mongoc_collection_t *collection,
15 bson_error_t *error);
16 BSON_GNUC_WARN_UNUSED_RESULT
17 BSON_GNUC_DEPRECATED_FOR (mongoc_collection_find_indexes_with_opts);
18
19 Fetches a cursor containing documents, each corresponding to an index
20 on this collection.
21
22 This function is considered a retryable read operation. Upon a tran‐
23 sient error (a network error, errors due to replica set failover, etc.)
24 the operation is safely retried once. If retryreads is false in the
25 URI (see mongoc_uri_t) the retry behavior does not apply.
26
28 • collection: A mongoc_collection_t.
29
30 • error: An optional location for a bson_error_t or NULL.
31
33 Errors are propagated via the error parameter.
34
36 This function returns a newly allocated mongoc_cursor_t that should be
37 freed with mongoc_cursor_destroy() when no longer in use. The returned
38 mongoc_cursor_t is never NULL, even on error. The user must call
39 mongoc_cursor_next() on the returned mongoc_cursor_t to execute the
40 initial command.
41
42 Cursor errors can be checked with mongoc_cursor_error_document(). It
43 always fills out the bson_error_t if an error occurred, and optionally
44 includes a server reply document if the error occurred server-side.
45
46 WARNING:
47 Failure to handle the result of this function is a programming er‐
48 ror.
49
50 In the returned cursor each result corresponds to the server's repre‐
51 sentation of an index on this collection. If the collection does not
52 exist on the server, the cursor will be empty.
53
54 The cursor functions mongoc_cursor_set_limit(),
55 mongoc_cursor_set_batch_size(), and
56 mongoc_cursor_set_max_await_time_ms() have no use on the returned cur‐
57 sor.
58
60 MongoDB, Inc
61
63 2017-present, MongoDB, Inc
64
65
66
67
681.25.1 Nov 08, 2023MONGOC_COLLECTION_FIND_INDEXES(3)