How can I compare 2 collections and show the documents which are same

I have 2 collection everyday in my database. Each day I have to compare these 2 collection and have to find out whether some specific elements of the documents are same in both the collection.
Example:
These collections have 500 + documents. Each document contains these columns or elements –
_id(which is different all the time), studentName, timeOfEntry, timeOfExit, section, class.
I have to find out which document in the 2 collection have same value for studentName, timeOfEntry and timeOfExit.
How can I achieve this?

You do a $lookup on your fields and if the resulting array size is $gt 0 then

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.