Skip to main content

Home > git-documentdb > Collection > putFatDoc

Collection.putFatDoc() method#

Insert data if not exists. Otherwise, update it.

Signature:
putFatDoc(shortName: string | undefined | null, doc: JsonDoc | Uint8Array | string, options?: PutOptions): Promise<PutResult>;

Parameters#

ParameterTypeDescription
shortNamestring | undefined | nullshortName is a file path whose collectionPath is omitted. shortName of JsonDoc must ends with extension.
docJsonDoc | Uint8Array | string
optionsPutOptions
Returns:

Promise<PutResult >

Remarks#

  • The saved file path is ${GitDocumentDB#workingDir}/${Collection#collectionPath}/${shortName}${extension} .

  • If shortName is undefined, it is automatically generated.

  • _id property of a JsonDoc is automatically set or overwritten by shortName parameter whose extension is omitted.

  • An update operation is not skipped even if no change occurred on a specified data.

Exceptions#

Err.InvalidJsonFileExtensionError

Err.InvalidJsonObjectError

Err.DatabaseClosingError

Err.TaskCancelError

# Errors from validateDocument, validateId

# Errors from putWorker