public function hasDocument(Document $document)
    {
        $documentCollection = $document->getCollection();
        $documentDatabase = $documentCollection->getDatabase();

        // check connection
        if ($documentDatabase->getClient()->getDsn() !== $this->getDatabase()->getClient()->getDsn()) {
            return false;
        }

        // check database
        if ($documentDatabase->getName() !== $this->getDatabase()->getName()) {
            return false;
        }

        // check collection
        return $documentCollection->getName() == $this->getName();
    }