FindAndModify Query for Mongo in PHP
If anyone has ever wondered what the quickest way to find a document and at the same time remove the document from that collection with MongoDB and PHP. This is the solution you need:
<?php $found = $coll->command(array('findandmodify' => '', 'query' => array('name' => 'superman'), 'sort' => array('created' => -1),'limit' => 1, 'remove' => true)); ?>
The documentation for this can be found here on the mongodb site.













