Updates a collection
499915
protected function updateCollection()
    {
        $this->controlAccess('collection_edit');

        if ($this->collection->update($this->data_collection['collection_id'], $this->getSubmitted())) {
            $this->redirect('admin/content/collection', $this->text('Collection has been updated'), 'success');
        }

        $this->redirect('', $this->text('Collection has not been updated'), 'danger');
    }
1115814
function collectionUpdate (collection, result) {
	result._id = createID(result.pattern, result.language);
	return collection.insertOne(result)
		.catch((e) => {
			// May fail due to concurrent update on the same value.
			log(`collectionUpdate: error: ${e}`);
			return Promise.resolve(PATTERN_INVALID);
		});
}
119404
def update(self, document_id, update_spec, namespace, timestamp):
        
        db, coll = self._db_and_collection(namespace)

        meta_collection_name = self._get_meta_collection(namespace)

        self.meta_database[meta_collection_name].replace_one(
            {self.id_field: document_id, "ns": namespace},
            {self.id_field: document_id, "_ts": timestamp, "ns": namespace},
            upsert=True,
        )

        no_obj_error = "No matching object found"
        update_spec.pop("$v", None)
        updated = self.mongo[db].command(
            SON(
                [
                    ("findAndModify", coll),
                    ("query", {"_id": document_id}),
                    ("update", update_spec),
                    ("new", True),
                ]
            ),
            allowable_errors=[no_obj_error],
        )["value"]
        return updated
72208
async def update(self, _id=None, **new_data):
		
		if not _id or not new_data:
			return {"error":400, 
					"reason":"Missed required fields"}

		document = await self.collection.find_one({"id":_id})
		if not document:
			return {"error":404, 
					"reason":"Not found"}

		for key in new_data:
			await self.collection.find_one_and_update(
							{"id": _id},
							{"$set": {key: new_data[key]}}
						)
		updated = await self.collection.find_one({"id":_id})
		return {"success":200, "reason": "Updated", **updated}
725782
function (event) {
      event.preventDefault();
      var collection = this.getCollection();
      var id = this.state.id;
      var model;
      if (id) {
        // Update existing model
        model = collection.get(id);
        model.save(this.state, {wait: true});
      } else {
        // Create a new one
        collection.create(this.state, {wait: true});
      }
      // Set initial state
      this.replaceState(this.getInitialState());
    }
623759
def update(handler, item_document):
    """"""
    data = {'operation': 'update',
            'encrypt': encrypt,
            'item': json.load(item_document)}
    handler.invoke(data)
383053
public function update(SmartCollection &$smartCollection)
    {
        $data = $smartCollection->exportData();
        $endpoint = '/admin/smart_collections/'.$smart_collection->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'smart_collection' => $data
            )
        );
        $smartCollection->setData($response['smart_collection']);
    }
412815
def update_one(cls, filter, update, upsert=False):
        
        return cls.collection.update_one(filter, update, upsert).raw_result
1020480
function collectionInsert(content) {

        // TODO - add uuid
        content['_id']         = uuid.v1();
        content['_createdAt']  = new Date().format("isoDateTime");
        content['_updatedAt']  = new Date().format("isoDateTime");

        collections[ this['_collection'] ][ collections[ this['_collection'] ].length ] = content;

        storage.setItem(this['_bucket'], JSON.stringify(collections));
    }
969589
public ServiceCall<Collection> updateCollection(UpdateCollectionOptions updateCollectionOptions) {
    Validator.notNull(updateCollectionOptions, "updateCollectionOptions cannot be null");
    String[] pathSegments = { "v1/environments", "collections" };
    String[] pathParameters = { updateCollectionOptions.environmentId(), updateCollectionOptions.collectionId() };
    RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    builder.query("version", versionDate);
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateCollection");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    final JsonObject contentJson = new JsonObject();
    if (updateCollectionOptions.name() != null) {
      contentJson.addProperty("name", updateCollectionOptions.name());
    }
    if (updateCollectionOptions.description() != null) {
      contentJson.addProperty("description", updateCollectionOptions.description());
    }
    if (updateCollectionOptions.configurationId() != null) {
      contentJson.addProperty("configuration_id", updateCollectionOptions.configurationId());
    }
    builder.bodyJson(contentJson);
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Collection.class));
  }
721901
protected function updateCollectionItem($collection_item_id)
    {
        if (!$this->isError() && !$this->collection_item->update($collection_item_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
190821
public function updateMany(): Collection
	{
		$collection = new Collection();

		foreach ($this->getInput() as $item) {
			$repository = clone $this;
			$repository->setInput($item);
			$collection->add($repository->update($repository->getInputId()));
		}

		return $collection;
	}
822556
public static void updateCollections(PropertyStorage storage, Transport transport) {
        storage.getProperties().forEach(e -> {
            if (Collection.class.isAssignableFrom(e.getKey().getType())) {
                // found a collection in properties
                ((Collection) e.getValue()).forEach(i -> {
                    if (i instanceof FluentStyle) {
                        ((FluentStyle) i).setTransport(transport);
                    }
                });

            }

        });
    }
1055532
def update_existing_collection(self,
                                   owner_id,
                                   collection_id=None,
                                   json_repr=None,
                                   auth_info=None,
                                   parent_sha=None,
                                   merged_sha=None,
                                   commit_msg=''):
        """"""
        collection = self._coerce_json_to_collection(json_repr)
        if collection is None:
            msg = "File failed to parse as JSON:\n{j}".format(j=json_repr)
            raise ValueError(msg)
        if not self._is_valid_collection_json(collection):
            msg = "JSON is not a valid collection:\n{j}".format(j=json_repr)
            raise ValueError(msg)
        if not collection_id:
            raise ValueError("Collection id not provided (or invalid)")
        if not self.has_doc(collection_id):
            msg = "Unexpected collection id '{}' (expected an existing id!)".format(collection_id)
            raise ValueError(msg)
        # pass the id and collection JSON to a proper git action
        r = None
        try:
            # remove any 'url' field before saving; it will be restored when the doc is fetched (via API)
            if 'url' in collection:
                del collection['url']
            # keep it simple (collection is already validated! no annotations needed!)
            r = self.commit_and_try_merge2master(file_content=collection,
                                                 doc_id=collection_id,
                                                 auth_info=auth_info,
                                                 parent_sha=parent_sha,
                                                 commit_msg=commit_msg,
                                                 merged_sha=merged_sha)
            # identify shard for this id!?
        except:
            raise
        return r
589550
public void update(Collection<Fovable> fovables)
    {
        mapHidden.update(fovables);
        mapFogged.reset();
        mapFogged.update(fovables);
    }
850061
protected function submitAddCollection()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('collection');
        $this->addCollection();
    }
1253090
function BindableCollection (source) {
  BindableObject.call(this, this);
  this.source = source || [];
  this._updateInfo();
  this.bind("source", _.bind(this._onSourceChange, this));
}