Home > git-documentdb > Collection > put
#
Collection.put() methodInsert a JSON document if not exists. Otherwise, update it.
Signature:#
ParametersParameter | Type | Description |
---|---|---|
shortId | string | undefined | null | shortId is a file path whose collectionPath and extension are omitted. |
jsonDoc | JsonDoc | |
options | PutOptions |
Promise<PutResultJsonDoc >
#
RemarksThe saved file path is
${GitDocumentDB#workingDir}/${Collection#collectionPath}/${shortId}${extension}
.If shortId is undefined, it is automatically generated.
_id property of a JsonDoc is automatically set or overwritten by a shortId parameter.
An update operation is not skipped even if no change occurred on a specified document.
#
Exceptions# Errors from validateDocument, validateId
# Errors from putWorker