Home > git-documentdb > Collection > update
Collection.update() method#
Update a JSON document
Signature:Parameters#
| Parameter | Type | Description |
|---|---|---|
| jsonDoc | JsonDoc | JsonDoc whose _id is shortId. shortId is a file path whose collectionPath and extension are omitted. |
| options | PutOptions |
Promise<PutResultJsonDoc >
Remarks#
Throws DocumentNotFoundError if a specified document does not exist. It might be better to use put() instead of update().
The saved file path is
${GitDocumentDB#workingDir}/${Collection#collectionPath}/${jsonDoc._id}${extension}.If _id is undefined, it is automatically generated.
An update operation is not skipped even if no change occurred on a specified document.
Exceptions#
# Errors from validateDocument, validateId
# Errors from putWorker