Skip to main content

Home > git-documentdb > GitDocumentDB > putFatDoc

GitDocumentDB.putFatDoc() method#

Insert data if not exists. Otherwise, update it.

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

Parameters#

ParameterTypeDescription
namestring | undefined | nullname is a file path.
docJsonDoc | Uint8Array | string
optionsPutOptions
Returns:

Promise<PutResult >

Remarks#

  • The saved file path is ${GitDocumentDB#workingDir}/${name}extension .

  • If a name parameter is undefined, it is automatically generated.

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

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

  • This is an alias of GitDocumentDB#rootCollection.putFatDoc()

Exceptions#

Err.InvalidJsonFileExtensionError

Err.InvalidJsonObjectError

Err.DatabaseClosingError

Err.TaskCancelError

# Errors from validateDocument, validateId

# Errors from putWorker