_id: 0, _id: 1, _id: -1 in $project

I probably missed it in the video lectures. Can someone please explain to me what:

$project: { _id: 0 } means?

_id: 0 --> order of document entry?
_id: 1 --> order of document entry, ascending?
_id: -1 --> order of document entry, descending?

Thank you.

You missed one of the most important part of the project lesson and mixing it all with the sort lesson.


  1. field : 0 - means exclude the field but _id is special
  2. field : 1 - means include the field but _id is special


  1. field : 1 - means sort ascending
  2. field : -1 - means sort descending

If you still mix the above notions at this time, I would recommend you restart the lectures.

1 Like

Thank you, brother. I was in a rush to finish the labs and didn’t realize the 1 and -1 , 0 had different uses depending on the operator.