title: Find duplicates across multiple MongoDb collections
body: <p>Coming from MySQL, I am wondering, how can we find duplicates across multiple collections in MongoDB ?</p>
  
  <p>Let say I have two (or more) collections :</p>
  
  <p><strong>human :</strong></p>
  
  <ul>
  <li>_id</li>
  <li>firstname</li>
  </ul>
  
  <p><strong>cat:</strong> </p>
  
  <ul>
  <li>_id</li>
  <li>nickname</li>
  </ul>
  
  <p><strong>What would be an efficient solution to list duplicated names. This includes if a name is used by 2+ users only, by 2+ cats only, or by at least one user and one cat. Our result should therefor contains duplicates of both collections AND duplicates across those collections (cats and humans with the same name)</strong></p>
  
  <p>Expected result : </p>
  
  <p>The list of the duplicated values, the number of occurence could be interesting but is not essential.</p>
  
  <hr>
  
  <p>Question is not about whether or not the proposed db schema would be appropriate in this situation, but about the best MongoDB solution.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>My description of a duplicate was not really what I intended it, if it is not existing in one collection but is duplicated in another collection it still is a duplicate</p>