/**
  * Releases any lock that exists on this document.
  *
  * @param object $document
  */
 public function unlock($document)
 {
     $criteria = array('_id' => $this->uow->getDocumentIdentifier($document));
     $lockMapping = $this->class->fieldMappings[$this->class->lockField];
     $this->collection->update($criteria, array($this->cmd.'unset' => array($lockMapping['name'] => true)));
     $this->class->reflFields[$this->class->lockField]->setValue($document, null);
 }
 /**
  * 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(array('_id' => $id)), array('_id'));
 }
 /**
  * Loads a list of documents by a list of field criteria.
  *
  * @param array $criteria
  * @return array
  */
 public function loadAll(array $query = array(), array $select = array())
 {
     $cursor = $this->_collection->find($query, $select);
     return new MongoCursor($this->_dm, $this->_dm->getHydrator(), $this->_class, $cursor);
 }