Doctrine\ODM\MongoDB\Persisters\DocumentPersister::exists PHP Method

exists() public method

Checks whether the given managed document exists in the database.
public exists ( object $document ) : boolean
$document object
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(array('_id' => $id)), array('_id'));
    }