1MONGOC_COLLECTION_FIND_INDEXES_WITH_lMOiOPbNTmGSoO(nC3g_)oCcOLLECTION_FIND_INDEXES_WITH_OPTS(3)
2
3
4
6 mongoc_collection_find_indexes_with_opts - mongoc_collection_find_in‐
7 dexes_with_opts()
8
10 mongoc_cursor_t *
11 mongoc_collection_find_indexes_with_opts (mongoc_collection_t *collection,
12 const bson_t *opts)
13 BSON_GNUC_WARN_UNUSED_RESULT;
14
15 Fetches a cursor containing documents, each corresponding to an index
16 on this collection.
17
18 This function is considered a retryable read operation. Upon a tran‐
19 sient error (a network error, errors due to replica set failover, etc.)
20 the operation is safely retried once. If retryreads is false in the
21 URI (see mongoc_uri_t) the retry behavior does not apply.
22
24 • collection: A mongoc_collection_t.
25
26 • opts: A bson_t containing additional options.
27
28 opts may be NULL or a BSON document with additional command options:
29
30 • sessionId: First, construct a mongoc_client_session_t with
31 mongoc_client_start_session(). You can begin a transaction with
32 mongoc_client_session_start_transaction(), optionally with a
33 mongoc_transaction_opt_t that overrides the options inherited from
34 collection, and use mongoc_client_session_append() to add the session
35 to opts. See the example code for mongoc_client_session_t.
36
37 • serverId: To target a specific server, include an int32 "serverId"
38 field. Obtain the id by calling mongoc_client_select_server(), then
39 mongoc_server_description_id() on its return value.
40
41 For a list of all options, see the MongoDB Manual entry on the listIn‐
42 dexes command.
43
45 Use mongoc_cursor_error() on the returned cursor to check for errors.
46
48 This function returns a newly allocated mongoc_cursor_t that should be
49 freed with mongoc_cursor_destroy() when no longer in use. The returned
50 mongoc_cursor_t is never NULL, even on error. The user must call
51 mongoc_cursor_next() on the returned mongoc_cursor_t to execute the
52 initial command.
53
54 Cursor errors can be checked with mongoc_cursor_error_document(). It
55 always fills out the bson_error_t if an error occurred, and optionally
56 includes a server reply document if the error occurred server-side.
57
58 WARNING:
59 Failure to handle the result of this function is a programming er‐
60 ror.
61
62 In the returned cursor each result corresponds to the server's repre‐
63 sentation of an index on this collection. If the collection does not
64 exist on the server, the cursor will be empty.
65
66 The cursor functions mongoc_cursor_set_limit(),
67 mongoc_cursor_set_batch_size(), and
68 mongoc_cursor_set_max_await_time_ms() have no use on the returned cur‐
69 sor.
70
72 MongoDB, Inc
73
75 2017-present, MongoDB, Inc
76
77
78
79
801.23.1 OctMO2N0G,OC2_0C2O2LLECTION_FIND_INDEXES_WITH_OPTS(3)