Creating a document:
$db->collection->insert($content);
// $newDocID = ???
I\'m trying to get the new document\'s id. How? Thanks.
You can also get _id before insert. Just add _id field to document with new MongoId ie.
$content['_id'] = new MongoId();
$db->collection->insert($content);
Also there are nice benefits of this: