I was creating some tests, and I got a problema with mongo _id value.
In a test, I am comparing a default ObjectId generated as follows:
private val defaultPersonId = "507f1f77bcf86cd799439011"
Using it before:
repository.save(Person(ObjectId(defaultPersonId), "Anthony", "Andrade"))
Checking if the document was saved, I see that the ObjectId is the default I created.
But when retrieving through a getForEntity it returns with a different value,
expected: <507f1f77bcf86cd799439011> but was: <507f1f771c2010192fca25b7>
Expected :507f1f77bcf86cd799439011
Actual :507f1f771c2010192fca25b7
My question is: Why it returns in a different way, and whether it would be possible to return as it is in the mongo.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…