title: Mongo DB query: find if a map stored in mongo contains a specific value
body: <p>I have a mongo collection as follows:</p>
  
  <pre><code>    {
      "id": "510aec8e8426e96c156a0946",  
      "name": "ABC",
      "categoryToShardMap": null
      },
      {
      "id": "510aecd284268e0f60e547a5",
      "name": "XYZ",
      "categoryToShardMap": {
      "shoes": 1
      },
      {
      "id": "510aecbd84268e0f60e547a4",
      "name": "AAA",
      "categoryToShardMap": {
       "shoes": 3,
       "jeans": 2
       }
  </code></pre>
  
  <p>Where I have declared field 'categoryToShardMap' as :</p>
  
  <pre><code>    private HashMap&lt;String, Long&gt; categoryToShardMap;
  </code></pre>
  
  <p>I am trying to create a REST Api where if someone provides the shardId, he should get back the mongo document which contains it. For example: if I pass shardId = 3, I should receive the mongo document:</p>
  
  <pre><code>    {
      "id": "510aecbd84268e0f60e547a4",
      "name": "AAA",
      "categoryToShardMap": {
      "shoes": 3,
      "jeans": 2
      }
  </code></pre>
  
  <p>I am trying to use java to do this. But I am not sure how should I query this using mongotemplate or DBObject. Can someone point to me to some examples on how to query if a map stored in mongo document contains a specified value?</p>