Skip to content

Commit

Permalink
#358 add uuid documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zigzago committed Aug 7, 2022
1 parent 6b8f246 commit c657b62
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kmongo-kdoc/docs/object-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,25 @@ val id: Id<A> = ObjectId().toId()
The Id type is optional,
you can use ```String```, ```org.bson.types.ObjectId``` of whatever you need as _id type.

#### UUID

In order to use UUID as identifier, you have to specify (as documented in mongo java driver):

```kotlin
KMongo.createClient(
MongoClientSettings
.builder()
.uuidRepresentation(UuidRepresentation.STANDARD)
.applyConnectionString(ConnectionString(connection))
.build()
)
```
For *jackson*, you also need to use the
[setUUIDRepresentation](http://litote.org/kmongo/dokka/kmongo/org.litote.kmongo.util/-k-mongo-jackson-feature/index.html)
function.


## Date support

KMongo provides built-in support for these "Date" classes:
Expand Down

0 comments on commit c657b62

Please sign in to comment.