All Collections
Realm
How do I work with ObjectId in Atlas UI, Mongo shell, Compass and App Services Function?
How do I work with ObjectId in Atlas UI, Mongo shell, Compass and App Services Function?

Syntax examples to query ObjectID in different MongoDB Products

Joao Boesso avatar
Written by Joao Boesso
Updated over a week ago

ObjectId in the Date Explorer of Atlas UI

To work with ObjectId in the Date Explorer of Atlas UI, use the syntax {"$oid": "<ObjectId bytes>"} as specified in the documentation. See the example below:

ObjectId in the Date Explorer of Mongo shell and Compass

To work with ObjectID in Mongo Shell and Compass, use the syntax ObjectId("<ObjectId bytes>"). See the example below:

ObjectId in an App Services function

To work with ObjectID in an App Services function, use the syntax new BSON.ObjectId("<ObjectId bytes>") as specified in the documentation. See the example below:


โ€‹

Did this answer your question?