Home > git-documentdb > GitDocumentDB > insert
GitDocumentDB.insert() method#
Insert a JSON document
Signature:Parameters#
| Parameter | Type | Description |
|---|---|---|
| _id | string | undefined | null | _id is a file path whose extension is omitted. |
| jsonDoc | JsonDoc | |
| options | PutOptions |
Promise<PutResultJsonDoc >
Remarks#
Throws SameIdExistsError when a document that has the same id exists. It might be better to use put() instead of insert().
The saved file path is
${GitDocumentDB#workingDir}/${_id}${extension}on the file system.If _id is undefined, it is automatically generated.
_id property of a JsonDoc is automatically set or overwritten by _id parameter.
This is an alias of GitDocumentDB#rootCollection.insert()
Exceptions#
# Errors from validateDocument, validateId
# Errors from putWorker