Tuesday 15 March 2011

mongolab - MongoDB $oid vs ObjectId -



mongolab - MongoDB $oid vs ObjectId -

i'm trying mongodb query working. collection comes in format:

{ "_id": { "$oid": "54651022bffebc03098b4567" }, "browser": "ie", "browser_version": "10.0 desktop", "os_version": "8", "device": null, "os": "windows" }

the next works:

{ "_id": { "$in": [ { "$oid": "54651022bffebc03098b4567" }, { "$oid": "54651022bffebc03098b4568" } ] } }

however, syntax error following:

{ "_id": { "$in": [ objectid("54651022bffebc03098b4567"), objectid("54651022bffebc03098b4568") ] } }

there similar questions suggested objectid should work:

how create query objectids using java?

$all parameter in mongodb not work objectid list

the mongolab ui uses strict mongodb extended json object ids represented thusly, in sec code block of op:

{ "$oid": "<id>" }

mongodb mongolab

No comments:

Post a Comment