diff --git a/kmongo-jackson-mapping/src/main/kotlin/org/litote/kmongo/util/MongoIdUtil.kt b/kmongo-jackson-mapping/src/main/kotlin/org/litote/kmongo/util/MongoIdUtil.kt index 2a46dec6..acfc6c6f 100644 --- a/kmongo-jackson-mapping/src/main/kotlin/org/litote/kmongo/util/MongoIdUtil.kt +++ b/kmongo-jackson-mapping/src/main/kotlin/org/litote/kmongo/util/MongoIdUtil.kt @@ -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 diff --git a/kmongo-jackson-mapping/src/test/kotlin/org/litote/kmongo/jackson/UUIDTest.kt b/kmongo-jackson-mapping/src/test/kotlin/org/litote/kmongo/jackson/UUIDTest.kt index 1754f502..b6103810 100644 --- a/kmongo-jackson-mapping/src/test/kotlin/org/litote/kmongo/jackson/UUIDTest.kt +++ b/kmongo-jackson-mapping/src/test/kotlin/org/litote/kmongo/jackson/UUIDTest.kt @@ -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)