I try to write application in Java and Spring Data MongoDB.
My document looks:
@Data
@ToString
public class SomeDocument {
private UUID id;
private String name;
}
Repository:
@Repository
public interface SomeDocumentMongoRepository extends MongoRepository<SomeDocument, UUID> {
}
It's very simple. And I saved the document:
{
"id": "5f4ac46b-55f7-4be4-b26f-2ca041334bec",
"name": "some name"
}
Then I tried to read it from database using simple query db.someDocument.find()
and I've got the result:
{ "_id" : BinData(3,"5Ev3VWvESl/sSzNBoCxvsg=="), "name" : "some name", "_class" : "org.springmongodemo.repo.SomeDocument" }
So my questions are:
- How to find in mongo shell document by
_id
using givenUUID
? - What does mean number 3 in
BinData(3,...)
?