Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/api/woqlclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ const response1 = await client.getDocument({"graph_type":"schema","as_list":true
```

## updateDocument
##### woqlClient.updateDocument(json, [params], [dbId], [message], [lastDataVersion], [getDataVersion]) ⇒ <code>Promise</code>
##### woqlClient.updateDocument(json, [params], [dbId], [message], [lastDataVersion], [getDataVersion], [create]) ⇒ <code>Promise</code>
**Returns**: <code>Promise</code> - A promise that returns the call response object or object having *result*
and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.

Expand All @@ -868,6 +868,7 @@ and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error
| [message] | <code>\*</code> | the update commit message |
| [lastDataVersion] | <code>string</code> | the last data version tracking id. |
| [getDataVersion] | <code>boolean</code> | If true the function will return object having result and dataVersion. |
| [create] | <code>boolean</code> | If true, the function will create a new document if it doesn't exist. |

**Example**
```javascript
Expand Down
4 changes: 3 additions & 1 deletion lib/woqlClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ WOQLClient.prototype.getDocument = function (params, dbId, branch, lastDataVersi
* @param {string} [lastDataVersion] the last data version tracking id.
* @param {boolean} [getDataVersion] If true the function will return object having result
* and dataVersion.
* @param {boolean} [create] If true, the function will create a new document if it doesn't exist.
* @returns {Promise} A promise that returns the call response object or object having *result*
* and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error if rejected.
* @example
Expand Down Expand Up @@ -1210,10 +1211,11 @@ WOQLClient.prototype.getDocument = function (params, dbId, branch, lastDataVersi
);
*/

WOQLClient.prototype.updateDocument = function (json, params, dbId, message = 'update document', lastDataVersion = '', getDataVersion = false, compress = false) {
WOQLClient.prototype.updateDocument = function (json, params, dbId, message = 'update document', lastDataVersion = '', getDataVersion = false, compress = false, create = false) {
const docParams = params || {};
docParams.author = this.author();
docParams.message = message;
docParams.create = create;
if (dbId) {
this.db(dbId);
}
Expand Down