dimanche 29 janvier 2017

Is there any difference between aggregate([{:$project => {:_id=>1}}]) and projection({:_id=>1}) in mongodb?

Both of the two expressions below in mongodb return the same value:

db.collection.find().aggregate([{:$project => {:_id=>1}}])

db.collection.find().projection({:_id=>1})

While I just wondering is there any difference between them?

Aucun commentaire:

Enregistrer un commentaire