Finding duplicate documents <p>I have some documents whose ids are randomly generated. The issue here is I need to find the duplicates amongst these documents. I have three fields which should not be identical for two documents. So how to check for duplicates based on multiple fields?</p> <p>Sample documents</p> <pre><code>document 1 = { "process" : "business", "processId" : 5433321, "country" : "US" } document 2 = { "process" : "operations", "processId" : 334233, "country" : "UK" } document 3 = { "process" : "business", "processId" : 5433321, "country" : "US" } </code></pre> <p>Here as you can see, document 1 and document 3 are the same, but they are having different Ids in my database,so exist as separate documents. So on run I need to find the above as duplicates and if possible keep only one.</p>