Phalcon\Db\Adapter\MongoDB\Operation\FindOneAndDelete::execute PHP Method

execute() public method

Execute the operation.
See also: Executable::execute()
public execute ( MongoDB\Driver\Server $server ) : object | null
$server MongoDB\Driver\Server
return object | null
    public function execute(Server $server)
    {
        return $this->findAndModify->execute($server);
    }

Usage Example

Beispiel #1
0
 /**
  * Finds a single document and deletes it, returning the original.
  *
  * The document to return may be null if no document matched the filter.
  *
  * Note: BSON deserialization of the returned document does not yet support
  * a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
  *
  * @see FindOneAndDelete::__construct() for supported options
  * @see http://docs.mongodb.org/manual/reference/command/findAndModify/
  *
  * @param array|object $filter Query by which to filter documents
  * @param array        $options Command options
  *
  * @return object|null
  */
 public function findOneAndDelete($filter, array $options = [])
 {
     $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
     if (!isset($options['writeConcern']) && Functions::serverSupportsFeature($server, self::$wireVersionForFindAndModifyWriteConcern)) {
         $options['writeConcern'] = $this->writeConcern;
     }
     $operation = new FindOneAndDelete($this->databaseName, $this->collectionName, $filter, $options);
     return $operation->execute($server);
 }
FindOneAndDelete