title: How to retrieve the document exactly matching a given value in mongodb
body: <p>from the mongodb official documentation :</p>
  
  <p>The following examples query against the inventory collection with the following documents:</p>
  
  <pre><code>{ _id: 1, item: { name: "ab", code: "123" }, qty: 15, tags: [ "A", "B", "C" ] }
  { _id: 2, item: { name: "cd", code: "123" }, qty: 20, tags: [ "B" ] }
  { _id: 3, item: { name: "ij", code: "456" }, qty: 25, tags: [ "A", "B" ] }
  { _id: 4, item: { name: "xy", code: "456" }, qty: 30, tags: [ "B", "A" ] }
  { _id: 5, item: { name: "mn", code: "000" }, qty: 20, tags: [ [ "A", "B" ], "C" ] }
  </code></pre>
  
  <p>The following example queries the inventory collection to select all documents where the tags array equals exactly the specified array or the tags array contains an element that equals the array [ "A", "B" ].</p>
  
  <pre><code>db.inventory.find( { tags: { $eq: [ "A", "B" ] } } )
  </code></pre>
  
  <p>The query is equivalent to:</p>
  
  <pre><code>db.inventory.find( { tags: [ "A", "B" ] } )
  </code></pre>
  
  <p>Both queries match the following documents:</p>
  
  <pre><code>{ _id: 3, item: { name: "ij", code: "456" }, qty: 25, tags: [ "A", "B" ] }
  { _id: 5, item: { name: "mn", code: "000" }, qty: 20, tags: [ [ "A", "B" ], "C" ] }
  </code></pre>
  
  <p>Now i wish to know how i can query in order to get the document(s) having its tags field exactly equal to <code>[ "A", "B" ]</code> and not containing it alone or among other elements ? i want the result for the example above will be only the first document returned :  </p>
  
  <pre><code>{ _id: 3, item: { name: "ij", code: "456" }, qty: 25, tags: [ "A", "B" ] }
  </code></pre>