How to prevent MongoDB from returning the object ID when finding a document?
Pass {'_id': False}
as a parameter to find()
db.users.find({ _id: ObjectId("531221cd960100960116b992")}, { addresses: { $slice: [0, 1] } ,'_id': False} )
This is exactly the same as @hanleyhansen's answer, but just to let you know that you can use 0 interchangeably with false like:
db.users.find(
{ _id: ObjectId("531221cd960100960116b992")},
{ addresses: { $slice: [0, 1] } ,'_id': 0}
)