It is easy to understand operator used in aggregate() below:
db.solarSystem.aggregate([
{$project:{name:1,_id:0}},
{$skip:1},
{$limit:2},
{$sort:{name:1}},
{$count:“count”}
])
However, the result from find() is a surprise to me. Can anyone explan on the issues below:
db.solarSystem.find({},{name:1,_id:0})
.skip(1)
.limit(2)
.sort({name:1})
Issue 1:
the result of find above is sort all elements before skip and limit
db.solarSystem.find({},{name:1,_id:0})
.skip(1)
.limit(2)
.sort({name:1})
.count()
Issue 2:
the result is 9, which is the result after find() but before skip, limit.