/** * Checks whether the given managed document exists in the database. * * @param object $document * @return boolean TRUE if the document exists in the database, FALSE otherwise. */ public function exists($document) { $id = $this->class->getIdentifierObject($document); return (bool) $this->collection->findOne(array('_id' => $id), array('_id')); }