1MONGOC_QUERY_FLAGS_T(3) libmongoc MONGOC_QUERY_FLAGS_T(3)
2
3
4
5Flags for query operations
6
8 typedef enum {
9 MONGOC_QUERY_NONE = 0,
10 MONGOC_QUERY_TAILABLE_CURSOR = 1 << 1,
11 MONGOC_QUERY_SECONDARY_OK = 1 << 2,
12 MONGOC_QUERY_OPLOG_REPLAY = 1 << 3,
13 MONGOC_QUERY_NO_CURSOR_TIMEOUT = 1 << 4,
14 MONGOC_QUERY_AWAIT_DATA = 1 << 5,
15 MONGOC_QUERY_EXHAUST = 1 << 6,
16 MONGOC_QUERY_PARTIAL = 1 << 7,
17 } mongoc_query_flags_t;
18
20 These flags correspond to the MongoDB wire protocol. They may be bit‐
21 wise or'd together. They may modify how a query is performed in the
22 MongoDB server.
23
25 ┌───────────────────────────┬────────────────────────────┐
26 │MONGOC_QUERY_NONE │ Specify no query flags. │
27 ├───────────────────────────┼────────────────────────────┤
28 │MONGOC_QUERY_TAILABLE_CUR‐ │ Cursor will not be closed │
29 │SOR │ when the last data is re‐ │
30 │ │ trieved. You can resume │
31 │ │ this cursor later. │
32 ├───────────────────────────┼────────────────────────────┤
33 │MONGOC_QUERY_SECONDARY_OK │ Allow query of replica set │
34 │ │ secondaries. │
35 ├───────────────────────────┼────────────────────────────┤
36 │MONGOC_QUERY_OPLOG_REPLAY │ Used internally by Mon‐ │
37 │ │ goDB. │
38 ├───────────────────────────┼────────────────────────────┤
39 │MONGOC_QUERY_NO_CUR‐ │ The server normally times │
40 │SOR_TIMEOUT │ out an idle cursor after │
41 │ │ an inactivity period (10 │
42 │ │ minutes). This prevents │
43 │ │ that. │
44 ├───────────────────────────┼────────────────────────────┤
45 │MONGOC_QUERY_AWAIT_DATA │ Use with MON‐ │
46 │ │ GOC_QUERY_TAILABLE_CURSOR. │
47 │ │ Block rather than return‐ │
48 │ │ ing no data. After a pe‐ │
49 │ │ riod, time out. │
50 ├───────────────────────────┼────────────────────────────┤
51 │MONGOC_QUERY_EXHAUST │ Stream the data down full │
52 │ │ blast in multiple "reply" │
53 │ │ packets. Faster when you │
54 │ │ are pulling down a lot of │
55 │ │ data and you know you want │
56 │ │ to retrieve it all. Only │
57 │ │ applies to cursors created │
58 │ │ from a find operation │
59 │ │ (i.e. │
60 │ │ mongoc_collection_find()). │
61 └───────────────────────────┴────────────────────────────┘
62
63
64
65
66
67 │MONGOC_QUERY_PARTIAL │ Get partial results from │
68 │ │ mongos if some shards are │
69 │ │ down (instead of throwing │
70 │ │ an error). │
71 └───────────────────────────┴────────────────────────────┘
72
74 MongoDB, Inc
75
77 2017-present, MongoDB, Inc
78
79
80
81
821.25.1 Nov 08, 2023 MONGOC_QUERY_FLAGS_T(3)