When I inserted some documents into a collection (without an ObjectID) mongoDB adds its own ObjectIDs.
I want to query a document by its unique ObjectID.
<
With alcaeus/mongo-php-adapter (under php 7), needed to convert \MongoId to BSON type:
\MongoId
$filter = []; $filter['_id'] = (new \MongoId('4e49fd8269fd873c0a000000'))->toBSONType(); $cursor = $collection->find($filter);