-
Notifications
You must be signed in to change notification settings - Fork 77
Description
@Serializable data class User( @Contextual @SerialName("_id") @JsonProperty("_id") val id: Id<User> = newId(), val nickName: String, val createdAt: Instant = System.now(), val updatedAt: Instant = createdAt, )
print user object:
User(id=6773740aed6dbd47aeb9718a, nickName=testBulkWrite, createdAt=2024-12-31T04:33:14.224893Z, updatedAt=2024-12-31T04:33:14.224893Z)
print user json string:
{"_id":"6773740aed6dbd47aeb9718a","nickName":"testBulkWrite","createdAt":"2024-12-31T04:33:14.224893Z","updatedAt":"2024-12-31T04:33:14.224893Z"}
When using the bulkWrite<User>("""[{ insertOne : { "document" : $userJson } }]""") method, the program executes to line 147 of "KMongoUtil.kt" where the value of if (!document.containsKey("_id")) is false. Should it be using document.getDocument("document").containsKey("_id") instead?
After testing, it should use """[{ insertOne : $userJson }]""".
| if (!document.containsKey("_id")) { |
