title: Query operation in Mongodb to find intersection between two dataset from the same collection
body: <p>I am new in Mongo and need help to form the query to retrieve following information from mongodb collection</p>
  
  <p>Say I have a collection that holds association of users with groups. Users can be assigned to some groups. In the following following example I want to find out the users who are part of group (1 OR 2) AND group 3, which will return user1 for the following data. Though user2 and user3 are part of group 1 and group 2 respectiveky, it will not be returned as they are not part of group 3</p>
  
  <hr>
  
  <pre><code>{
  _id : NumberLong(1),
  user : "user1",
  group : NumberLong(1),
  }
  {
  _id : NumberLong(2),
  user : "user1",
  group : NumberLong(2),
  }
  {
  _id : NumberLong(3),
  user : "user1",
  group : NumberLong(3),
  }
  {
  _id : NumberLong(1),
  user : "user2",
  group : NumberLong(1),
  }
  {
  _id : NumberLong(1),
  user : "user3",
  group : NumberLong(2),
  }
  </code></pre>