What are differences between find and $match

-Looks like $match almost performs same functionality as find
-Apart from one been a aggregate operator…does it have any other difference?
-Are aggregate operators done on the db and returned the complete results …instead of client looping through the find operation is it one of the difference…any document links towards this same would be helpful.

@mantyaku you are right that find and match performs similar function. With a main difference that match is used in aggregation framework whereas, find is not.

If you just want to do a ‘straight’ find, then the find function is okay to use. On the other hand, if you want to do more, this is where the Aggregate framework steps in. With $match as on of the ‘stages’ in performing an aggregate task. And $match performs the function of find() in the Aggregate framework.

If this makes sense to you, then I may have learned something in this course. :slight_smile:

Cheers,

Ben

Hi,

@Benjamin_93799 is right. If your query can be done with find() and you do not require additional processing, just use find(). Use the aggregation framework otherwise.

José Carlos