java - MongoDB: error code - 10068, invalid operator: $oid -
i tried query in mongodb database using java code, throws
java.lang.illegalargumentexception: cannot parse query: { _id: {$oid:"myid"}}
i run same query in mongodb shell
> db.collection.find({ _id: {$oid:"myid"}})
but fails error
error: { "$err" : "invalid operator: $oid", "code" : 10068 }
what reason of error , how solve problem?
as error message says invalid operator $oid
you can query using 1 of those
db.collection.find({_id: "your_id"}); db.collection.find({_id:objectid("5408c3aaca92988d9c70343d")});
Comments
Post a Comment