Update the object directly.

        .. code-block:: python

            DBSession.sacrud(Users)._add(UserObj, {'name': 'Gennady'})
342716
def _add(self, obj, data, **kwargs):
        
        if isinstance(obj, sqlalchemy.orm.query.Query):
            obj = obj.one()
        obj = self.preprocessing(obj=obj or self.table)\
            .add(self.session, data, self.table)
        self.session.add(obj)
        if kwargs.get('commit', self.commit) is True:
            try:
                self.session.commit()
            except AssertionError:
                transaction.commit()
        return obj
495689
def update(self, table_name, primary_key, instance):
        
        assert isinstance(primary_key, dict)
        assert isinstance(instance, BaseDocument)
        collection = self._db[table_name]

        # work with a copy of the document, as the direct type change of the _id field
        # is later negated by the `BaseDocument.to_json` method
        document = instance.document
        if '_id' in document:
            document['_id'] = ObjectId(document['_id'])

        update_result = collection.replace_one(filter=primary_key, replacement=document, upsert=True)
        if update_result.upserted_id:
            instance['_id'] = update_result.upserted_id
        return update_result.upserted_id
577500
def update(data)
      headers = @client.make_request(:post, @client.concat_user_path("#{CALL_PATH}/#{id}"), data)[1]
      if headers[:location]
         Client.get_id_from_location_header(headers[:location])
      end
    end
734808
function update(req, res, next) {
  var body = req.body;
  delete body.username;

  db.users.update(req.params.user, body, function(err, user) {
    if(err) { return next(err); }
    res.json(201, user);
  });
}
1314357
def _legacy_add_user(self, name, password, read_only, **kwargs):
        
        # Use a Collection with the default codec_options.
        system_users = self._collection_default_options('system.users')
        user = system_users.find_one({"user": name}) or {"user": name}
        if password is not None:
            user["pwd"] = auth._password_digest(name, password)
        if read_only is not None:
            user["readOnly"] = read_only
        user.update(kwargs)

        # We don't care what the _id is, only that it has one
        # for the replace_one call below.
        user.setdefault("_id", ObjectId())
        try:
            system_users.replace_one({"_id": user["_id"]}, user, True)
        except OperationFailure as exc:
            # First admin user add fails gle in MongoDB >= 2.1.2
            # See SERVER-4225 for more information.
            if 'login' in str(exc):
                pass
            # First admin user add fails gle from mongos 2.0.x
            # and 2.2.x.
            elif (exc.details and
                  'getlasterror' in exc.details.get('note', '')):
                pass
            else:
                raise
909901
def update(self, id, data):
        
        id = self.as_id(id)
        response = self.http.patch(
            '%s/%s' % (self, id), json=data, auth=self.auth
        )
        response.raise_for_status()
        return response.json()
961345
def update_user(resource_root, user):
  
  return call(resource_root.put,
      '%s/%s' % (USERS_PATH, user.name), ApiUser, data=user)
1314781
private ObjectResult updateObject(DBObject                          dbObj,
                                      Map<String, String>               currScalarMap,
                                      Map<String, Map<String, Integer>> targObjShardNos) {
        ObjectResult objResult = null;
        if (Utils.isEmpty(dbObj.getObjectID())) {
            objResult = ObjectResult.newErrorResult("Object ID is required", null);
        } else if (currScalarMap == null) {
            objResult = ObjectResult.newErrorResult("No object found", dbObj.getObjectID());
        } else {
            ObjectUpdater objUpdater = new ObjectUpdater(m_tableDef);
            if (targObjShardNos.size() > 0) {
                objUpdater.setTargetObjectShardNumbers(targObjShardNos);
            }
            objResult = objUpdater.updateObject(m_parentTran, dbObj, currScalarMap);
        }
        return objResult;
    }
486967
def users_update_many(self, data, external_ids=None, ids=None, **kwargs):
        ""
        api_path = "/api/v2/users/update_many.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if external_ids:
            api_query.update({
                "external_ids": external_ids,
            })
        if ids:
            api_query.update({
                "ids": ids,
            })
        return self.call(api_path, query=api_query, method="PUT", data=data, **kwargs)
736446
def update(self, obj_id, is_public=NotUpdated, is_protected=NotUpdated):
        """"""

        data = {}
        self._copy_if_updated(data, is_public=is_public,
                              is_protected=is_protected)
        return self._patch('/job-executions/%s' % obj_id, data)
1349498
private ObjectResult addOrUpdateObject(DBObject                          dbObj,
                                           Map<String, String>               currScalarMap,
                                           Map<String, Map<String, Integer>> targObjShardNos)
            throws IOException {
        ObjectUpdater objUpdater = new ObjectUpdater(m_tableDef);
        if (targObjShardNos.size() > 0) {
            objUpdater.setTargetObjectShardNumbers(targObjShardNos);
        }
        if (currScalarMap == null || currScalarMap.size() == 0) {
            return objUpdater.addNewObject(m_parentTran, dbObj);
        } else {
            return objUpdater.updateObject(m_parentTran, dbObj, currScalarMap);
        }
    }
980309
def update(self, request, *args, **kwargs):
        
        instance = self.get_object()
        if (not request.user.has_perm('edit_collection', instance.collection)
                and not request.user.is_superuser):
            return Response(status=status.HTTP_401_UNAUTHORIZED)

        return super().update(request, *args, **kwargs)
765826
def update(uid=None):
    
    app.logger.info("PUT /sync route with id: %s" % uid)

    try:
        user = Participant.query.\
            filter(Participant.uniqueid == uid).\
            one()
    except exc.SQLAlchemyError:
        app.logger.error("DB error: Unique user not found.")

    if hasattr(request, 'json'):
        user.datastring = request.data.decode('utf-8').encode(
            'ascii', 'xmlcharrefreplace'
        )
        db_session.add(user)
        db_session.commit()

    try:
        data = json.loads(user.datastring)
    except:
        data = {}

    trial = data.get("currenttrial", None)
    app.logger.info("saved data for %s (current trial: %s)", uid, trial)
    resp = {"status": "user data saved"}
    return jsonify(**resp)
1213273
public void update(Connection conn, User user) throws SQLException {
        String sql = "UPDATE userbase \n";
        Integer id = user.getId();
        user.setId(null);
        try {
            String s = SQLBuilder.beanToSQLClause(user,",");
            sql = sql + SQLBuilder.getSetClause(s) +"\n"+
                "WHERE id=? ";
        } catch (JibuException e) {
            throw new SQLException(e.getMessage());
        }
        user.setId(id);
        run.update(conn, sql, id);
    }
732261
private function update_dict()
    {
        if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
            $userid = $this->rc->get_user_id();
        }

        $plugin = $this->rc->plugins->exec_hook('spell_dictionary_save', array(
            'userid' => $userid, 'language' => $this->lang, 'dictionary' => $this->dict));

        if (!empty($plugin['abort'])) {
            return;
        }

        if ($this->have_dict) {
            if (!empty($this->dict)) {
                $this->rc->db->query(
                    "UPDATE " . $this->rc->db->table_name('dictionary', true)
                    ." SET `data` = ?"
                    ." WHERE `user_id` " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                        ." AND `language` = ?",
                    implode(' ', $plugin['dictionary']), $plugin['language']);
            }
            // don't store empty dict
            else {
                $this->rc->db->query(
                    "DELETE FROM " . $this->rc->db->table_name('dictionary', true)
                    ." WHERE `user_id` " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                        ." AND `language` = ?",
                    $plugin['language']);
            }
        }
        else if (!empty($this->dict)) {
            $this->rc->db->query(
                "INSERT INTO " . $this->rc->db->table_name('dictionary', true)
                ." (`user_id`, `language`, `data`) VALUES (?, ?, ?)",
                $plugin['userid'], $plugin['language'], implode(' ', $plugin['dictionary']));
        }
    }
547429
async def update(self, **kwargs):
        '''
        
        '''
        try:
            self.data[self.pk] = self.pk_type(kwargs['pk'])
            updated_obj = await self._meta.object_class().update(self.db, data=self.data)
            if updated_obj is None:
                raise NotFound('Object matching the given {} was not found'.format(self.pk))
            return await updated_obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)
254533
def update_db(self, giver, receiverkarma):
        

        for receiver in receiverkarma:
            if receiver != giver:
                urow = KarmaStatsTable(
                    ude(giver), ude(receiver), receiverkarma[receiver])
                self.db.session.add(urow)
        self.db.session.commit()