Skip to content

Commit

Permalink
handle 'id' property as well in model objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiss Laszlo committed Jul 13, 2021
1 parent 9c2413a commit 0cebbb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal object MongoIdUtil {

private fun getIdProperty(type: KClass<*>): KProperty1<*, *>? =
try {
type.memberProperties.find { "_id" == it.name }
type.memberProperties.find { "_id" == it.name || "id" == it.name}
} catch (error: KotlinReflectionInternalError) {
//ignore
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class UUIDTest
val bytes = mapper.writeValueAsBytes(testObject)

// Check the type of the binary representation of the UUID
assertEquals(if(uuidRepresentation == UuidRepresentation.STANDARD) 4 else 3, bytes[12].toInt())
assertEquals(if(uuidRepresentation == UuidRepresentation.STANDARD) 4 else 3, bytes[13].toInt())

val decodedObject: TestingObject = mapper.readValue(bytes)

Expand Down

0 comments on commit 0cebbb5

Please sign in to comment.