diff --git a/docs/api/woqlclient.md b/docs/api/woqlclient.md index add28300..0c653b7f 100644 --- a/docs/api/woqlclient.md +++ b/docs/api/woqlclient.md @@ -856,7 +856,7 @@ const response1 = await client.getDocument({"graph_type":"schema","as_list":true ``` ## updateDocument -##### woqlClient.updateDocument(json, [params], [dbId], [message], [lastDataVersion], [getDataVersion]) ⇒ Promise +##### woqlClient.updateDocument(json, [params], [dbId], [message], [lastDataVersion], [getDataVersion], [create]) ⇒ Promise **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. @@ -868,6 +868,7 @@ and *dataVersion* object if ***getDataVersion*** parameter is true, or an Error | [message] | \* | the update commit message | | [lastDataVersion] | string | the last data version tracking id. | | [getDataVersion] | boolean | If true the function will return object having result and dataVersion. | +| [create] | boolean | If true, the function will create a new document if it doesn't exist. | **Example** ```javascript diff --git a/lib/woqlClient.js b/lib/woqlClient.js index c7ee3b34..edb91712 100644 --- a/lib/woqlClient.js +++ b/lib/woqlClient.js @@ -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 @@ -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); }