Saves the document by only updating the modified fields.
        The default behaviour concening the keepNull parameter is the opposite of ArangoDB's default, Null values won't be ignored
        Use docArgs for things such as waitForSync = True
493445
def patch(self, keepNull = True, **docArgs) :
        """"""

        if self.URL is None :
            raise ValueError("Cannot patch a document that was not previously saved")

        payload = self._store.getPatches()
        
        if self.collection._validation['on_save'] :
            self.validate()

        if len(payload) > 0 :
            params = dict(docArgs)
            params.update({'collection': self.collection.name, 'keepNull' : keepNull})
            payload = json.dumps(payload, default=str)

            r = self.connection.session.patch(self.URL, params = params, data = payload)
            data = r.json()
            if (r.status_code == 201 or r.status_code == 202) and "error" not in data :
                self._rev = data['_rev']
            else :
                raise UpdateError(data['errorMessage'], data)

            self.modified = False

        self._store.resetPatch()
91528
def change_and_save(self, update_only_changed_fields=False, **changed_fields):
        
        change_and_save(self, update_only_changed_fields=update_only_changed_fields, **changed_fields)
        return self
113410
async def save(self, db):
        
        kwargs = {}
        for col in self._auto_columns:
            if not self.has_real_data(col.name):
                kwargs[col.name] = await col.auto_generate(db, self)
        self.__dict__.update(kwargs)

        # we have to delete the old index key
        stale_object = await self.__class__.load(db, identifier=self.identifier())
        d = {
            k: (v.strftime(DATETIME_FORMAT) if isinstance(v, datetime) else v)
            for k, v in self.__dict__.items()
        }
        success = await db.hmset_dict(self.redis_key(), d)
        await self.save_index(db, stale_object=stale_object)
        return success
208948
public Collection<Object> persist(Collection<Object> objColl) {
    if (null == objColl) {
      throw new IllegalArgumentException("object to save cannot be null");
    }

    objMapper.saveObjCollection(keyspace, objColl);
    return objColl;
  }
548756
def save(self, mark):
        
        self._check_exists()
        obj = mark.as_dict()
        try:
            # Make a 'filter' to find/update existing record, which uses
            # the field name and operation (but not the position).
            filt = {k: obj[k] for k in (mark.FLD_FLD, mark.FLD_OP)}
            _log.debug("save: upsert-spec={} upsert-obj={}".format(filt, obj))
            self._track.update(filt, obj, upsert=True)
        except pymongo.errors.PyMongoError as err:
            raise DBError("{}".format(err))
357685
def create(self):
        

        # Ensure that an existing document will not be "updated"
        doc = dict(self)
        if doc.get('_rev') is not None:
            doc.__delitem__('_rev')

        headers = {'Content-Type': 'application/json'}
        resp = self.r_session.post(
            self._database.database_url,
            headers=headers,
            data=json.dumps(doc, cls=self.encoder)
        )
        resp.raise_for_status()
        data = response_to_json_dict(resp)
        super(Document, self).__setitem__('_id', data['id'])
        super(Document, self).__setitem__('_rev', data['rev'])
930933
protected function saveNewBinding()
    {
        $modified_properties = $this->getModifiedProperties();

        if (count($modified_properties) === 0) {
            return;
        }

        $fields = array();
        $values = array();

        foreach ($this->getModifiedProperties() as $name => $value) {
            $type = $this->guessType($name, $value);
            $fields[] = sprintf('%s:%s', $type, $name);
            $values[$name] = $value;
        }

        SwatDB::insertRow($this->db, $this->table, $fields, $values);
        $this->flushCacheNamespaces();
    }
960211
def save(self):
        
        resp = self.r_session.put(
            self.document_url,
            data=self.json(),
            headers={'Content-Type': 'application/json'}
        )
        resp.raise_for_status()
240556
public function save( $fields = null ) 
	{
		$settings = static::_model();

		// check if we should save just some fields
		if ( is_null( $fields ) ) 
		{
			$fields = array_keys( $settings['defaults'] );
		}
		elseif ( !is_array( $fields ) ) 
		{
			$fields = array( $fields );
		}

		$pkey = $this->_data_store[$settings['primary_key']];
		$data = array();

		// Now we have to filter the data to the save g
		foreach( $fields as $field )
		{
			$data[$field] = $this->_data_store[$field];
		}

		// We have to remove the primary key from our data
		if ( array_key_exists( $settings['primary_key'], $data ) )
		{
			unset( $data[$settings['primary_key']] );
		}

		// We pass the data trough the before save callback.
		// This is a local callback for performence reasons.
		$data = $this->_before_save( $data );

		// after the before save event,
		// do we have to to something with the data type?
		foreach( $data as $key => $value )
		{
			if ( array_key_exists( $key, $settings['types'] ) )
			{
				$data[$key] = $this->_type_assignment_set( $settings['types'][$key], $value );
			}
		}

		// check if we have to set the timestamps automatically
		if ( $settings['timestamps'] === true )
		{
			if ( array_key_exists( 'created_at', $data ) )
			{
				// check if created_at should be set
				if ( $data['created_at'] < 1 )
				{
					$this->_data_store['created_at'] = $data['created_at'] = time();
				}
			}

			if ( array_key_exists( 'modified_at', $data ) )
			{
				$this->_data_store['modified_at'] =$data['modified_at'] = time();
			}
		}

		// When we already have a primary key we are going to 
		// update our record instead of inserting a new one.
		if ( !is_null( $pkey ) && $pkey > 0 ) 
		{
			$query = DB::update( $settings['table'], $data )
				->where( $settings['primary_key'], $pkey );
		}
		// No primary key? Smells like an insert query. 
		else 
		{
			$query = DB::insert( $settings['table'], $data );
		}

		// We check the query type to handle the response right
		if ( $query instanceof Query_Insert ) 
		{
			$this->_data_store[$settings['primary_key']] = $query->run();
		}
		else 
		{
			$query->run();
		}

		// after save hookt
		$this->_after_save();

		// return self
		return $this;
	}
1205292
def save(self, *args, **kwargs):
        
        if not self.instance.id:
            self.instance.created_by = self.user
        self.instance.last_modified_by = self.user
        return super(ChangeableContentForm, self).save(*args, **kwargs)
609717
def save(self):
    """"""
    req = datastore.CommitRequest()
    req.mode = datastore.CommitRequest.NON_TRANSACTIONAL
    req.mutations.add().upsert.CopyFrom(self.to_proto())
    resp = datastore.commit(req)
    if not self.id:
      self.id = resp.mutation_results[0].key.path[-1].id
    return self
57529
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
    private C4Document save(Document document, C4Document base, boolean deletion)
        throws LiteCoreException {
        FLSliceResult body = null;
        try {
            int revFlags = 0;
            if (deletion) { revFlags = C4Constants.RevisionFlags.DELETED; }
            if (!deletion && !document.isEmpty()) {
                // Encode properties to Fleece data:
                body = document.encode();
                if (C4Document.dictContainsBlobs(body, sharedKeys.getFLSharedKeys())) {
                    revFlags |= C4Constants.RevisionFlags.HAS_ATTACHMENTS;
                }
            }

            // Save to database:
            final C4Document c4Doc = base != null ? base : document.getC4doc();
            if (c4Doc != null) { return c4Doc.update(body, revFlags); }

            return getC4Database().create(document.getId(), body, revFlags);
        }
        finally {
            if (body != null) { body.free(); }
        }
    }
435987
protected function store($updateNulls=false)
  {
    $row = TableRow::create();
    
    foreach($this->getFields() as $fieldName => $fieldInfos){
      $fieldValue = $this->row->get($fieldName);
      
      switch($fieldInfos->Type){
        case 'bigint':
        case 'mediumint':
        case 'smallint':
        case 'tinyint':
          $fieldValue = (int)$fieldValue;
          break;
        
        case 'datetime':
        case 'timestamp':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(true);
          }
          break;
        
        case 'date':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(false);
          }
          break;
        
        case 'time':
          if ( !$fieldValue ){
            $fieldValue = '00:00:00';
          }
          break;
      }
      
      $row->set($fieldName, $fieldValue);
    }
    
    if ( $row->get($this->tbl_key) ){
      $ret = $this->db->updateObject($this->tbl, $row, $this->tbl_key, $updateNulls);
    }
    else {
      $ret = $this->db->insertObject($this->tbl, $row, $this->tbl_key);
      $this->row->set($this->tbl_key, (int)$row->get($this->tbl_key));      
    }
    
    if ( $ret ){
      if ( $this->orderingAble() ){
        $this->reorder( $this->getReorderConditions() );
      }
      return true;
    }
    
    return false;
  }
295117
function save() {
        var res = this;
        res.$created = true;
        return this.$loc.$save(this.$toObject()).then(function() {
          emitter.emit('updated', res);
          if (!res.$resolved) {
            res.$deferred.resolve(res);
            res.$resolved = true;
          }
          return res;
        });
      }
599047
def save(self):
        ''''''
        self._check_custom_fields()

        if not self._changes:
            return None

        for tag in self._remap_to_id:
            self._remap_tag_to_tag_id(tag, self._changes)

        # Check for custom handlers for tags
        for tag, type in self._field_type.items():
            try:
                raw_data = self._changes[tag]
            except:
                continue

            # Convert datetime type to a datetime string that Redmine expects
            if type == 'datetime':
                try:
                    self._changes[tag] = raw_data.strftime('%Y-%m-%dT%H:%M:%S%z')
                except AttributeError:
                    continue

            # Convert date type to a date string that Redmine expects
            if type == 'date':
                try:
                    self._changes[tag] = raw_data.strftime('%Y-%m-%d')
                except AttributeError:
                    continue


        try:
            self._update(self._changes)
        except:
            raise
        else:
            # Successful save, woot! Now clear the changes dict
            self._changes.clear()
817823
@Override
	public <S extends T> S save(S entity, boolean consistentRead) {
		return operations.createOrUpdate(entity);
	}
778660
function updateDocument(existingDoc, newDoc, id, db, f_ShouldUpdate, shouldCreate, f_Merge, callback) {
    if (!f_ShouldUpdate) {
        f_ShouldUpdate = always;
    }

    if (!f_Merge) {
        f_Merge = useNewVersion;
    }

    // If we never grabbed the existing document from the DB, fetch it and try again.
    if (!existingDoc) {
        return db.get(id, function (err, r) {
            // If the fetch came back with nothing, attempt to do a fresh insert unless the user
            // doesn't want documents to be created.
            if (err && (err.error === "not_found")) {
                if (!shouldCreate)
                    // Don't create a document where one didn't exist, if the user so desires.
                    return callback(null, null);

                return db.insert(newDoc, id, function (err, r) {
                    // If someone beat us here, we should retry this whole operation.
                    if (err && err.error === "conflict")
                        return updateDocument(null, newDoc, id, db, f_ShouldUpdate, shouldCreate, f_Merge, callback);

                    // If anything else happened, we should bail.
                    if (err)
                        return callback("Could not fetch existing document: " + err.toString());

                    // The insert worked.  We're done.
                    return callback(null, extend({}, newDoc, {_rev: r.rev}));
                });
            }

            // If the fetch came back with any other error, bail.
            if (err)
                return callback("Could not fetch existing document: " + err.toString());

            // We got the document.  Let's try the update again.
            return updateDocument(r, newDoc, id, db, f_ShouldUpdate, shouldCreate, f_Merge, callback);
        });
    }

    if (!f_ShouldUpdate(existingDoc, newDoc)) {
        return callback(null, existingDoc);
    }

    // Before merging, record that we want to undelete a document that has been deleted.
    var mergedDoc = f_Merge(omit(existingDoc, "_deleted"), newDoc);
    if (!mergedDoc || typeof mergedDoc !== "object" || mergedDoc instanceof Error) {
        // Allow a user defined merge algorithm to say ``sorry...can't merge'' by returning a non-object or Error.
        // Bubble this error, so that the user can then test for it in their callback.
        return callback(mergedDoc);
    }

    // It's essential that we specify a revision or this will never terminate.
    // It's probably not a good idea to trust a user-specified merge function to do this.
    mergedDoc = extend({}, mergedDoc, { _rev: existingDoc._rev });

    // The document exists, and is out of date.  We need to overwrite it.
    db.insert(
        mergedDoc,
        id,
        function (err, result) {
            // If someone beat us here, we need to try the whole thing again.
            if (err && err.error === "conflict")
                return updateDocument(null, newDoc, id, db, f_ShouldUpdate, shouldCreate, f_Merge, callback);

            // If anything else happened, bail.
            if (err)
                return callback("Could not update the document to the proposed version: " + err.toString());

            // Update the new document's _rev
            mergedDoc._rev = result.rev;

            // The replacement worked.  We're done.  Finally!
            return callback(null, mergedDoc);
        }
    );
}