You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
method, or via the [`ClassModelBuilder.conventions(conventions)`]({{<apiref "org/bson/codecs/pojo/ClassModelBuilder.html#conventions-java.util.List-">}})
method, or via the [`ClassModelBuilder.conventions(conventions)`]({{<apiref "org/bson/codecs/pojo/ClassModelBuilder.html#conventions(java.util.List)">}})
332
332
method.
333
333
334
334
{{% note class="note" %}}
@@ -408,7 +408,7 @@ If a POJO contains a field that has an abstract type or has an interface as its
408
408
subtypes / implementations need to be registered with the `PojoCodecProvider` so that values can be encoded and decoded correctly.
409
409
410
410
The easiest way to enable a discriminator is to annotate the abstract class with the `Discriminator` annotation. Alternatively, the
Copy file name to clipboardExpand all lines: docs/reference/content/driver-async/getting-started/quick-start-pojo.md
+13-13
Original file line number
Diff line number
Diff line change
@@ -187,7 +187,7 @@ Remember, always check for errors in any `SingleResultCallback<T>` implementatio
187
187
For sake of brevity, this tutorial omits the error check logic in the code examples.
188
188
{{% /note %}}
189
189
190
-
To insert a Person into the collection, you can use the collection's [`insertOne()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertOne-TDocument-" >}}) method.
190
+
To insert a Person into the collection, you can use the collection's [`insertOne()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertOne(TDocument)" >}}) method.
191
191
192
192
```java
193
193
Person ada =newPerson("Ada Byron", 20, newAddress("St James Square", "London", "W1"));
@@ -201,7 +201,7 @@ collection.insertOne(ada, new SingleResultCallback<Void>() {
201
201
202
202
### Insert Many Persons
203
203
204
-
To add multiple Person instances, you can use the collection's [`insertMany()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertMany-java.util.List-" >}}) method
204
+
To add multiple Person instances, you can use the collection's [`insertMany()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertMany(java.util.List)" >}}) method
205
205
which takes a list of `Person`.
206
206
207
207
The following example will add multiple Person instances into the collection:
@@ -228,7 +228,7 @@ collection.insertMany(people, new SingleResultCallback<Void>() {
228
228
229
229
## Query the Collection
230
230
231
-
To query the collection, you can use the collection's [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method.
231
+
To query the collection, you can use the collection's [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find()">}}) method.
232
232
233
233
The following example prints all the Person instances in the collection:
234
234
```java
@@ -249,7 +249,7 @@ SingleResultCallback<Void> callbackWhenFinished = new SingleResultCallback<Void>
To query for Person instance that match certain conditions, pass a filter object to the [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method.
264
+
To query for Person instance that match certain conditions, pass a filter object to the [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find()">}}) method.
265
265
To facilitate creating filter objects, Java driver provides the [`Filters`]({{< apiref "com/mongodb/client/model/Filters.html">}}) helper.
266
266
267
267
{{% note class="important" %}}
@@ -272,7 +272,7 @@ By default they are the same but it is possible to change how POJO property name
272
272
273
273
### Get A Single Person That Matches a Filter
274
274
275
-
For example, to find the first `Person` in the database that lives in `Wimborne` pass an [`eq`]({{<apiref "com/mongodb/client/model/Filters.html#eq-java.lang.String-TItem-">}})
275
+
For example, to find the first `Person` in the database that lives in `Wimborne` pass an [`eq`]({{<apiref "com/mongodb/client/model/Filters.html#eq(java.lang.String,TItem)">}})
To update documents in a collection, you can use the collection's [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) and [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) methods.
304
+
To update documents in a collection, you can use the collection's [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne(org.bson.conversions.Bson,org.bson.conversions.Bson)">}}) and [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany(org.bson.conversions.Bson,org.bson.conversions.Bson)">}}) methods.
305
305
306
306
Pass to the methods:
307
307
@@ -313,7 +313,7 @@ The update methods return an [`UpdateResult`]({{<apiref "com/mongodb/client/resu
313
313
314
314
### Update a Single Person
315
315
316
-
To update at most a single `Person`, use the [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) method.
316
+
To update at most a single `Person`, use the [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne(org.bson.conversions.Bson,org.bson.conversions.Bson)">}}) method.
317
317
318
318
The following example updates `Ada Byron` setting their age to `23` and name to `Ada Lovelace`:
To update all Persons that match a filter, use the [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) method.
332
+
To update all Persons that match a filter, use the [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany(org.bson.conversions.Bson,org.bson.conversions.Bson)">}}) method.
333
333
334
334
The following example sets the zip field to `null` for all documents that have a `zip` value:
An alternative method to change an existing `Person`, would be to use the [`replaceOne`]({{<apiref "com/mongodb/client/MongoCollection.html#replaceOne-org.bson.conversions.Bson-TDocument-">}}) method.
343
+
An alternative method to change an existing `Person`, would be to use the [`replaceOne`]({{<apiref "com/mongodb/client/MongoCollection.html#replaceOne(org.bson.conversions.Bson,TDocument)">}}) method.
344
344
345
345
The following example replaces the `Ada Lovelace` back to the original document:
To delete documents from a collection, you can use the collection's [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne-org.bson.conversions.Bson-">}}) and [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) methods.
353
+
To delete documents from a collection, you can use the collection's [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne(org.bson.conversions.Bson)">}}) and [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany(org.bson.conversions.Bson)">}}) methods.
354
354
355
355
Pass to the methods a filter object to determine the document or documents to delete. To facilitate creating filter objects, Java driver provides the [`Filters`]({{< apiref "com/mongodb/client/model/Filters.html">}}) helper. To specify an empty filter (i.e. match all documents in a collection), use an empty [`Document`]({{< apiref "org/bson/Document.html" >}}) object.
356
356
@@ -359,7 +359,7 @@ which provides information about the operation including the number of documents
359
359
360
360
### Delete a Single Person That Matches a Filter
361
361
362
-
To delete at most a single `Person` that matches a filter, use the [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne-org.bson.conversions.Bson-">}}) method:
362
+
To delete at most a single `Person` that matches a filter, use the [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne(org.bson.conversions.Bson)">}}) method:
363
363
364
364
The following example deletes at most one `Person` who lives in `Wimborne`:
To delete multiple Persons matching a filter use the [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) method.
379
+
To delete multiple Persons matching a filter use the [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany(org.bson.conversions.Bson)">}}) method.
380
380
381
381
The following example deletes all Persons that live in `London`:
0 commit comments