/** * Remove records from this collection * * @param array $criteria - Description of records to remove. * @param array $options - Options for remove. "justOne" Remove at * most one record matching this criteria. * * @return bool|array - Returns an array containing the status of the * removal if the "w" option is set. Otherwise, returns TRUE. Fields * in the status array are described in the documentation for * MongoCollection::insert(). */ public function remove(array $criteria = [], array $options = []) { $timeout = MongoCursor::$timeout; if (!empty($options['timeout'])) { $timeout = $options['timeout']; } return $this->client->_getWriteProtocol()->opDelete($this->fqn, $criteria, $options, $timeout); }
/** * Execute a database command * * @param array $command - The query to send. * @param array $options - This parameter is an associative array of * the form array("optionname" => boolean, ...). * * @return array - Returns database response. */ public function command(array $cmd, array $options = []) { $timeout = MongoCursor::$timeout; if (!empty($options['timeout'])) { $timeout = $options['timeout']; } $protocol = empty($options['protocol']) ? $this->client->_getWriteProtocol() : $options['protocol']; $response = $protocol->opQuery("{$this->name}.\$cmd", $cmd, 0, -1, 0, $timeout); return $response['result'][0]; }