Simple find
or where
queries can also be written as aggregate queries using $match
. Which of these is a better and faster approach to get the result from the MongoDB? E.g.
Boy.where(name: 'Ankit')
Boy.collection.aggregate([{'$match': {name: 'Ankit'}}])
Can someone please point out the difference in both the queries performance wise?