Is there any difference between following two queries, please explain
db.grades.aggregate([{$sort: {type:1 score:1 } }])
and
db.grades.find().sort({type:1, score:1})
I got the same result when I run these queries, please explain functional and performance differences
Thanks
sort() applies to the documents that are being returned.
$sort applies to all of the element inside of such documents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With