Issues quering Mongo data stored as UUID?
AnsweredTo query your Mongo data stored as UUID, for example
db.test.find({_id:UUID("aade7df0-04f2-476c-a475-c9854e6a1c6e")})
You'll need to modify your Mongo datasource with the following properties:
- If using Mongo version 3.xx, set uuidRepresentation=javaLegacy to use BinData
- the query will be
db.test.find({_id:BinData(3,“AAAQAAAAQACAAAAAAAAAAA==“)})
- If using Mongo version 4.xx, set uuidRepresentation=standard
- the query will be
db.test.find({_id:UUID("aade7df0-04f2-476c-a475-c9854e6a1c6e")})
For more information, check out https://mongodb.github.io/mongo-java-driver/3.5/javadoc/org/bson/UuidRepresentation.html
Please sign in to leave a comment.
0 comments