@@ -63,15 +63,15 @@ c++ --std=c++11 <input>.cpp
63
63
## Make a Connection
64
64
65
65
** IMPORTANT** : Before making any connections, you need to create one and only
66
- one instance of [ ` mongocxx::instance ` ] ({{< api3ref classmongocxx_1_1instance >}}).
66
+ one instance of [ ` mongocxx::instance ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1instance >}}).
67
67
This instance must exist for the entirety of your program.
68
68
69
69
To connect to a running MongoDB instance, use the
70
- [ ` mongocxx::client ` ] ({{< api3ref classmongocxx_1_1client >}})
70
+ [ ` mongocxx::client ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1client >}})
71
71
class.
72
72
73
73
You must specify the host to connect to using a
74
- [ ` mongocxx::uri ` ] ({{< api3ref classmongocxx_1_1uri >}}) instance containing a
74
+ [ ` mongocxx::uri ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1uri >}}) instance containing a
75
75
[ MongoDB URI] ( https://www.mongodb.com/docs/manual/reference/connection-string/ ) ,
76
76
and pass that into the ` mongocxx::client ` constructor. For details regarding
77
77
supported URI options see the documentation for the version of libmongoc used
@@ -96,10 +96,10 @@ mongocxx::client client(uri);
96
96
97
97
## Access a Database
98
98
99
- Once you have a [ ` mongocxx::client ` ] ({{< api3ref classmongocxx_1_1client >}})
99
+ Once you have a [ ` mongocxx::client ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1client >}})
100
100
instance connected to a MongoDB deployment, use either the
101
101
` database() ` method or ` operator[] ` to obtain a
102
- [ ` mongocxx::database ` ] ({{< api3ref classmongocxx_1_1database >}})
102
+ [ ` mongocxx::database ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1database >}})
103
103
instance.
104
104
105
105
If the database you request does not exist, MongoDB creates it when you
@@ -114,9 +114,9 @@ auto db = client["mydb"];
114
114
## Access a Collection
115
115
116
116
Once you have a
117
- [ ` mongocxx::database ` ] ({{< api3ref classmongocxx_1_1database >}})
117
+ [ ` mongocxx::database ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1database >}})
118
118
instance, use either the ` collection() ` method or ` operator[] ` to obtain a
119
- [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1collection >}})
119
+ [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1collection >}})
120
120
instance.
121
121
122
122
If the collection you request does not exist, MongoDB creates it when
@@ -204,18 +204,18 @@ throw an instance of
204
204
### Insert One Document
205
205
206
206
To insert a single document into the collection, use a
207
- [`mongocxx::collection`]({{< api3ref classmongocxx_1_1collection >}})
207
+ [`mongocxx::collection`]({{< api3ref classmongocxx_1_1v__noabi_1_1collection >}})
208
208
instance's `insert_one()` method to insert `{ "i": 0 }`:
209
209
210
210
```c++
211
211
auto insert_one_result = collection.insert_one(make_document(kvp("i", 0)));
212
212
```
213
213
214
214
` insert_one_result ` is an optional [ ` mongocxx::result::insert_one ` ] ({{< api3ref
215
- classmongocxx_1_1result_1_1insert_one >}}). In this example, ` insert_one_result `
215
+ classmongocxx_1_1v __ noabi_1_1result_1_1insert_one >}}). In this example, ` insert_one_result `
216
216
is expected to be set. The default behavior for write operations is to wait for
217
217
a reply from the server. This may be overriden by setting an unacknowledged
218
- [ ` mongocxx::write_concern ` ] ({{< api3ref classmongocxx_1_1write __ concern >}}).
218
+ [ ` mongocxx::write_concern ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1write __ concern >}}).
219
219
220
220
``` c++
221
221
assert (insert_one_result); // Acknowledged writes return results.
@@ -226,7 +226,7 @@ MongoDB automatically adds an `_id` field to the inserted document.
226
226
227
227
You can obtain this value using the `inserted_id()` method of the
228
228
returned
229
- [`mongocxx::result::insert_one`]({{< api3ref classmongocxx_1_1result_1_1insert__one >}})
229
+ [`mongocxx::result::insert_one`]({{< api3ref classmongocxx_1_1v__noabi_1_1result_1_1insert__one >}})
230
230
instance.
231
231
232
232
```c++
@@ -237,7 +237,7 @@ assert(doc_id.type() == bsoncxx::type::k_oid);
237
237
### Insert Multiple Documents
238
238
239
239
To insert multiple documents to the collection, use a
240
- [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1collection >}}) instance's
240
+ [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1collection >}}) instance's
241
241
` insert_many() ` method, which takes a list of documents to insert.
242
242
243
243
The following example inserts the documents ` { "i": 1 } ` and ` { "i": 2 } ` .
@@ -262,7 +262,7 @@ MongoDB automatically adds a `_id` field to the inserted documents.
262
262
263
263
You can obtain this value using the `inserted_ids()` method of the
264
264
returned
265
- [`mongocxx::result::insert_many`]({{< api3ref classmongocxx_1_1result_1_1insert__many >}})
265
+ [`mongocxx::result::insert_many`]({{< api3ref classmongocxx_1_1v__noabi_1_1result_1_1insert__many >}})
266
266
instance.
267
267
268
268
```c++
@@ -278,7 +278,7 @@ To query the collection, use the collection’s `find()` and
278
278
` find_one ` methods.
279
279
280
280
` find() ` will return an instance of
281
- [ ` mongocxx::cursor ` ] ({{< api3ref classmongocxx_1_1cursor >}}),
281
+ [ ` mongocxx::cursor ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1cursor >}}),
282
282
while ` find_one() ` will return an instance of
283
283
` std::optional< ` [ ` bsoncxx::document::value ` ] ({{< api3ref classbsoncxx_1_1document_1_1value >}})` > `
284
284
@@ -369,7 +369,7 @@ To update documents in a collection, you can use the collection’s
369
369
` update_one() ` and ` update_many() ` methods.
370
370
371
371
The update methods return an instance of
372
- ` std::optional< ` [ ` mongocxx::result::update ` ] ({{< api3ref classmongocxx_1_1result_1_1update >}})` > ` ,
372
+ ` std::optional< ` [ ` mongocxx::result::update ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1result_1_1update >}})` > ` ,
373
373
which provides information about the operation including the number of
374
374
documents modified by the update.
375
375
@@ -411,7 +411,7 @@ To delete documents from a collection, you can use a collection’s
411
411
` delete_one() ` and ` delete_many() ` methods.
412
412
413
413
The delete methods return an instance of
414
- ` std::optional< ` [ ` mongocxx::result::delete ` ] ({{< api3ref classmongocxx_1_1result_1_1delete __ result >}})` > ` ,
414
+ ` std::optional< ` [ ` mongocxx::result::delete ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1result_1_1delete __ result >}})` > ` ,
415
415
which contains the number of documents deleted.
416
416
417
417
### Delete a Single Document
@@ -447,7 +447,7 @@ assert(delete_many_result->deleted_count() == 2);
447
447
To create an [ index] ( https://www.mongodb.com/docs/manual/indexes/ ) on a
448
448
field or set of fields, pass an index specification document to the
449
449
` create_index() ` method of a
450
- [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1collection >}}) instance. An
450
+ [ ` mongocxx::collection ` ] ({{< api3ref classmongocxx_1_1v __ noabi_1_1collection >}}) instance. An
451
451
index key specification document contains the fields to index and the
452
452
index type for each field:
453
453
0 commit comments