Finds a document in the collection and performs the given update.

@param filter the query filter
@param update the update document
@param options A RemoteFindOneAndModifyOptions struct
@return the resulting document
12395
public DocumentT findOneAndUpdate(final Bson filter,
                                    final Bson update,
                                    final RemoteFindOneAndModifyOptions options) {
    return proxy.findOneAndUpdate(filter, update, options);
  }
864221
public function updateMany(array $filter, $update, array $options = [])
    {
        list($bulkOptions, $options) = self::extractBulkWriteOptions($options);
        $model = new UpdateMany($filter, $update, $options);

        $bulkWriteResult = $this->bulkWrite([$model], $bulkOptions);

        return new UpdateResult($bulkWriteResult);
    }
137077
public static xen_upgrade[] get_filtered(nitro_service service, String filter) throws Exception
	{
		xen_upgrade obj = new xen_upgrade();
		options option = new options();
		option.set_filter(filter);
		xen_upgrade[] response = (xen_upgrade[]) obj.getfiltered(service, option);
		return response;
	}
1344451
public function update($document, array $options = array())
    {
        $update = $this->pb->prepareUpdateData($document);

        $query = $this->getQueryForDocument($document);

        foreach (array_keys($query) as $field) {
            unset($update['$set'][$field]);
        }

        if (empty($update['$set'])) {
            unset($update['$set']);
        }

        if ( ! empty($update)) {
            // Include versioning logic to set the new version value in the database
            // and to ensure the version has not changed since this document object instance
            // was fetched from the database
            if ($this->class->isVersioned) {
                $versionMapping = $this->class->fieldMappings[$this->class->versionField];
                $currentVersion = $this->class->reflFields[$this->class->versionField]->getValue($document);
                if ($versionMapping['type'] === 'int') {
                    $nextVersion = $currentVersion + 1;
                    $update['$inc'][$versionMapping['name']] = 1;
                    $query[$versionMapping['name']] = $currentVersion;
                    $this->class->reflFields[$this->class->versionField]->setValue($document, $nextVersion);
                } elseif ($versionMapping['type'] === 'date') {
                    $nextVersion = new \DateTime();
                    $update['$set'][$versionMapping['name']] = new \MongoDate($nextVersion->getTimestamp());
                    $query[$versionMapping['name']] = new \MongoDate($currentVersion->getTimestamp());
                    $this->class->reflFields[$this->class->versionField]->setValue($document, $nextVersion);
                }
            }

            // Include locking logic so that if the document object in memory is currently
            // locked then it will remove it, otherwise it ensures the document is not locked.
            if ($this->class->isLockable) {
                $isLocked = $this->class->reflFields[$this->class->lockField]->getValue($document);
                $lockMapping = $this->class->fieldMappings[$this->class->lockField];
                if ($isLocked) {
                    $update['$unset'] = array($lockMapping['name'] => true);
                } else {
                    $query[$lockMapping['name']] = array('$exists' => false);
                }
            }

            $result = $this->collection->update($query, $update, $options);

            if (($this->class->isVersioned || $this->class->isLockable) && ! $result['n']) {
                throw LockException::lockFailed($document);
            }
        }
    }
943894
public static filteraction[] get_filtered(nitro_service service, String filter) throws Exception{
		filteraction obj = new filteraction();
		options option = new options();
		option.set_filter(filter);
		filteraction[] response = (filteraction[]) obj.getfiltered(service, option);
		return response;
	}
417851
public function findAndModify(array $query, array $update = array(), array $fields = null, array $options = array())
    {
        $document = new Document($query, $this);
        $findAndModify = $document->findAndModify($update, $fields, $options);

        return $findAndModify;
    }
1180072
function _update(query, op, criteria, doc, options, force, callback) {
  query.op = op;

  if (Query.canMerge(criteria)) {
    query.merge(criteria);
  }

  if (doc) {
    query._mergeUpdate(doc);
  }

  if (utils.isObject(options)) {
    // { overwrite: true }
    query.setOptions(options);
  }

  // we are done if we don't have callback and they are
  // not forcing an unsafe write.
  if (!(force || callback)) {
    return query;
  }

  if (!query._update ||
      !query.options.overwrite && 0 === utils.keys(query._update).length) {
    callback && utils.soon(callback.bind(null, null, 0));
    return query;
  }

  options = query._optionsForExec();
  if (!callback) options.safe = false;

  criteria = query._conditions;
  doc = query._updateForExec();

  debug('update', query._collection.collectionName, criteria, doc, options);
  callback = query._wrapCallback(op, callback, {
    conditions: criteria,
    doc: doc,
    options: options
  });

  query._collection[op](criteria, doc, options, utils.tick(callback));

  return query;
}
521874
public function queryDocument($collection, $sql, array $params = [], array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->query($sql, $params);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
250054
public static service[] get_filtered(nitro_service service, String filter) throws Exception{
		service obj = new service();
		options option = new options();
		option.set_filter(filter);
		service[] response = (service[]) obj.getfiltered(service, option);
		return response;
	}
264154
def filter_update(self, id, phrase = None, context = None, irreversible = None, whole_word = None, expires_in = None):
        
        id = self.__unpack_id(id)
        params = self.__generate_params(locals(), ['id'])
        url = '/api/v1/filters/{0}'.format(str(id))
        return self.__api_request('PUT', url, params)
414572
public void appendExists(Filter<S> filter) throws FetchException {
        mStatementBuilder.append(" WHERE ");
        mStatementBuilder.append("EXISTS (SELECT * FROM");

        JDBCStorableInfo<S> info;

        final JDBCRepository repo = mStatementBuilder.getRepository();
        try {
            info = repo.examineStorable(filter.getStorableType());
        } catch (RepositoryException e) {
            throw repo.toFetchException(e);
        }

        JoinNode jn;
        try {
            JoinNodeBuilder jnb =
                new JoinNodeBuilder(repo, info, mAliasGenerator);
            filter.accept(jnb, null);
            jn = jnb.getRootJoinNode();
        } catch (UndeclaredThrowableException e) {
            throw repo.toFetchException(e);
        }

        jn.appendFullJoinTo(mStatementBuilder);

        mStatementBuilder.append(" WHERE ");

        {
            int i = 0;
            for (JDBCStorableProperty<S> property : info.getPrimaryKeyProperties().values()) {
                if (i > 0) {
                    mStatementBuilder.append(" AND ");
                }
                mStatementBuilder.append(mJoinNode.getAlias());
                mStatementBuilder.append('.');
                mStatementBuilder.append(property.getColumnName());
                mStatementBuilder.append('=');
                mStatementBuilder.append(jn.getAlias());
                mStatementBuilder.append('.');
                mStatementBuilder.append(property.getColumnName());
                i++;
            }
        }

        mStatementBuilder.append(" AND (");

        WhereBuilder<S> wb = new WhereBuilder<S>(mStatementBuilder, jn, mAliasGenerator);

        FetchException e = filter.accept(wb, null);
        if (e != null) {
            throw e;
        }

        // Transfer property filters so that the values are extracted properly.
        mPropertyFilters.addAll(wb.mPropertyFilters);
        mPropertyFilterNullable.addAll(wb.mPropertyFilterNullable);

        mStatementBuilder.append(')');
        mStatementBuilder.append(')');
    }
1049334
public function update($values = [], $query = null, $options = [])
    {
        if ($values instanceof Closure) {
            $callback = $values;

            $values = new Query\Update();
            $values->setOptions($options);
            $callback($values);
        }

        if ($values instanceof Query\Update) {
            $options = $values->getOptions();
            $query = $values->getWhere();
            $values = $values->getUpdate();
        }

        if (! is_array($values) || ! is_array($options)) {
            throw new \InvalidArgumentException('Update params $update and $options must be arrays.');
        }

        isset($query) || $query = [];

        $maxRetries = $this->maxRetries;
        $tries = 0;

        do {
            try {
                $result = $this->collection->update($query, $values, $options);
                break;
            } catch (MongoCursorException $e) {
                // Retry "save" in case of rediscovery latency issues
                // in replica set failover. Error codes 10107, 13435, and 10058
                // are MongoCursorException's "not master" errors.
                if (in_array($e->getCode(), [10107, 13435, 10058])) {
                    if ($tries === $maxRetries) {
                        throw $e;
                    } else {
                        $tries++;
                        continue;
                    }
                } else {
                    throw $e;
                }
            }
        } while ($tries <= $maxRetries);

        return $result === true || (bool) $result['ok'];
    }
869936
function find($filter=NULL,array $options=NULL,$ttl=0) {
		if (!$options)
			$options=[];
		$options+=[
			'group'=>NULL,
			'order'=>NULL,
			'limit'=>0,
			'offset'=>0
		];
		return $this->select($this->fields,$filter,$options,$ttl);
	}
193207
public static cmpaction[] get_filtered(nitro_service service, String filter) throws Exception{
		cmpaction obj = new cmpaction();
		options option = new options();
		option.set_filter(filter);
		cmpaction[] response = (cmpaction[]) obj.getfiltered(service, option);
		return response;
	}
510115
function(schemaName, target, cb, options) {
  var schema  = SCHEMA[schemaName]
    , idField = schema._idField_
    , id      = target[idField]
    , options = options || {}

  if (typeof id == 'undefined' || id === '') {
    cb && cb(new Error('update ' + schemaName + ' failed: ID is not exist'))
    return
  }

  var key = schemaName + ':' + id

  client.hgetall(key, function(err, object) {
    if (!object && options.mode != 'insert') {
      cb && cb(err || new Error('update ' + key + ' failed: object doesn\'t exist'))
      return
    }

    filter(schemaName, target, function(err, result) {
      if (err || result === false) {
        cb && cb(err || new Error('update ' + schemaName + ' failed: invalid field value'))
        return
      }

      client.hmset(schemaName + ':' + id, target, function(err) {
        if (err) {
          cb && cb(err)
          return
        }

        filter(schemaName, target, cb, { FUNCS: COMMANDS, mode: options.mode, oldModel: object  })
      })
    }, { FUNCS: FILTERS, mode: options.mode, oldModel: object })

  })

}
335790
public function update(array $data, array $filter = [], array $updateOptions = [])
    {
        // Set statement of bulk object
        $bulk = $this->getBulk();
        $bulk->update($filter, $data, $updateOptions);

        try {
            $response = $this->getInstance()->executeBulkWrite(
                $this->getParam('database') . '.' . $this->getCollection(),
                $bulk,
                $this->getWrite()
            );

        } catch (BulkWriteException $e) {
            new Exception('Unable to write in database');
        }

        return $response ?? false;
    }
109790
public Task<DocumentT> findOneAndUpdate(final Bson filter, final Bson update) {
    return dispatcher.dispatchTask(new Callable<DocumentT>() {
      @Override
      public DocumentT call() {
        return proxy.findOneAndUpdate(filter, update);
      }
    });
  }