title: How to run Mongo Shell Query directly from PHP?
body: <p>I want to run MongoDB raw query directly from PHP.</p>
  
  <p>My query is like below.</p>
  
  <pre><code>var document_id = db.Document.aggregate([{$project: {"creationDate":1,'_id':1}},{$match: {"_id":ObjectID("5aa7a8852f4b3e2e86004837")}}]).toArray();
  
  document_id = document_id[0]['_id'];
  
  var upload_id = db.Upload.aggregate([{$project: {"creationDate":1,'_id':1}},{$match: {"_id":ObjectID("5aa7a8852f4b3e2e86004837")}}]).toArray();
  
  upload_id = upload_id[0]['_id'];
  </code></pre>
  
  <p>and get result of those two variable document_id &amp; upload_id of concat or multiple or addition. </p>
  
  <blockquote>
    <p>( FYI: In real, I won't concat or multiply ids it is just for example. )</p>
  </blockquote>
  
  <p>I have checked "<a href="http://php.net/manual/en/book.mongodb.php" rel="nofollow noreferrer">http://php.net/manual/en/book.mongodb.php</a>" for reference but nothing found useful.</p>
  
  <p>Can anyone guide me on that ?</p>
  
  <p><strong>Version of MongoDB &amp; PHP MongoDB driver I am using.</strong> </p>
  
  <p>MongoDB version 3.6</p>
  
  <p>MongoDB PHP Driver version 1.5</p>