title: How to get list of fields from Object in mongoDB?
body: <p>I'm new in mongoDB, I saw enough examples but most show how to work with collections.</p>
  
  <p>I have followed data stored in mongoDB under DB name <code>myDB</code>:</p>
  
  <pre><code>"_id" : "some_table_name",
  "content" : [{
    "id" : "1",
    "loctype" : "Clinic/Hospital",
    "locname" : "KKH"
  }, {
    "id" : "2",
    "loctype" : "Clinic/Hospital",
    "locname" : "Singapore National Eye Centre"      
   }
   }]
  }
  </code></pre>
  
  <p>As you can see the model contains <code>_id</code> and <code>content</code>, where <code>content</code> is list of objects: </p>
  
  <pre><code>  ... ,
   {
    "id" : "ZZZ",
    "loctype" : "ZZZ",
    "locname" : "ZZZ"      
    },
    ...
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>$m = new MongoClient(/* ... */);
  
  $db = $m-&gt;myDB;
  
  $collection = $db-&gt;coll;
  </code></pre>
  
  <p><strong>How can I fetch in PHP list of ids?</strong> a.e <code>[1,2]</code> in my case.</p>
  
  <p>For sure I can get all model and extract ids but I try to do it stright from mongoDB.</p>
  
  <p>Thanks.</p>