I have a quick question, what is the fast way to grab and delete an object from a mongo collection. Here is the code, I have currently:
$cursor = $coll->find(
Peter,
It's hard to say what the best solution is here without understanding all the context - but one approach which you could use is findAndModify
. This will query for a single document and return it, and also apply an update to it.
You could use this to find a document to process and simultaneously modify a "status" field to mark it as being processed, so that other workers can recognize it as such and ignore it.
There is an example here that may be useful: http://docs.mongodb.org/manual/reference/command/findAndModify/