Skip to content

Commit 27e5321

Browse files
committed
Docs: Updated Person annotation example
JAVA-2870
1 parent 65ecbc4 commit 27e5321

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/reference/content/bson/pojos.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,20 @@ import org.bson.codecs.pojo.annotations.*;
363363

364364
@BsonDiscriminator
365365
public final class Person {
366+
367+
@BsonId
366368
public String personId;
367369
public String firstName;
370+
371+
@BsonProperty("surname")
368372
public String lastName;
369-
373+
374+
@BsonIgnore
375+
public String password;
376+
370377
@BsonProperty(useDiscriminator = true)
371378
public Address addr;
372-
379+
373380
public Person(){
374381
}
375382

@@ -379,7 +386,7 @@ public final class Person {
379386
The `Person` POJO Will produce BSON similar to:
380387

381388
```json
382-
{ "_id": "1234567890", "_t": "Person", "firstName": "Alan", "lastName": "Turing",
389+
{ "_id": "1234567890", "_t": "Person", "firstName": "Alan", "surname": "Turing",
383390
"address": { "_t": "Address", "address": "The Mansion", "street": "Sherwood Drive",
384391
"town": "Bletchley", "postcode": "MK3 6EB" } }
385392
```

0 commit comments

Comments
 (0)