title: Retrieve only the sub document element in an object array in MongoDB collection in laravel
body: <p>Consider the following collection,</p>
  
  <pre><code> {
        "_id": ObjectId("545c535e75de3e630c8b4567"),
  
          "tables" : [
                  {
                      "_id" : ObjectId("54584f5975de3e040fe97319"),
                      "title" : "001",
                  },
                  {
                      "_id" : ObjectId("54584fb175de3e1c0fe97319"),
                      "title" : "002",
                  }
          ]
   }
  </code></pre>
  
  <p>I need to retrieve data from this collection where tables.title = "001". I used laravel framework. I tried following codes, but not properly worked. If someone have an idea to solve this please help me.</p>
  
  <pre><code>DB::connection($this-&gt;connection)-&gt;collection($this-&gt;collection)-&gt;where('tables','elemMatch',array('title'=&gt;"001"))-&gt;get();
  
  DB::connection($this-&gt;connection)-&gt;collection($this-&gt;collection)-&gt;where('tables.title',"001")-&gt;get();
  
  DB::connection($this-&gt;connection)-&gt;collection($this-&gt;collection)-&gt;where('tables.$.title',"001")-&gt;get();
  </code></pre>