title: Get index of an element mongodb aggregation
body: <p>Here is my collection</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
          "_id" : ObjectId("5c225f9a66d39d55c036fa66"),
          "name" : "Sherlock",
          "mobile" : "999999",
          "adress" : [
                  {
                          "street" : "221b baker street",
                          "city" : "london"
                  },
                  {
                          "street" : "ben street",
                          "city" : "london"
                  }
          ],
          "tags" : [
                  "Detective",
                  "Magician",
                  "Avenger"
          ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now I want to get the first or second value inside address array.
  for that I'm using this command.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&gt; db.agents.findOne({"name" : "Sherlock"},{"adress" : 1})</code></pre>
  </div>
  </div>
  </p>
  
  <p>but instead of giving a single result it is giving the entire array like</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
          "_id" : ObjectId("5c225f9a66d39d55c036fa66"),
          "adress" : [
                  {
                          "street" : "221b baker street",
                          "city" : "london"
                  },
                  {
                          "street" : "ben street",
                          "city" : "london"
                  }
          ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>It can be done by comparing array value like</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> db.agents.find({"adress.street": "ben street"}, {_id: 0, 'adress.$': 1});</code></pre>
  </div>
  </div>
  </p>
  
  <p>But I don't want to compare just to print the array indexes. How can I get the single result? 
  Any help is appreciated..</p>