-
Notifications
You must be signed in to change notification settings - Fork 17
Add document:upsert #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add document:upsert #576
Conversation
Codecov Report
@@ Coverage Diff @@
## 7-dev #576 +/- ##
==========================================
- Coverage 88.28% 87.61% -0.67%
==========================================
Files 32 32
Lines 1451 1462 +11
Branches 254 261 +7
==========================================
Hits 1281 1281
- Misses 120 130 +10
- Partials 50 51 +1
Continue to review full report at Codecov.
|
Co-authored-by: Sébastien Cottinet <[email protected]>
Co-authored-by: Sébastien Cottinet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO the signature should be
upsert (index: string, collection: string, id: string, changes: JSONObject, options: { defaults?: JSONObject, retryOnConflict?: number, refresh?: 'wait_for', source?: boolean })
| `index` | <pre>string</pre> | Index name | | ||
| `collection` | <pre>string</pre> | Collection name | | ||
| `id` | <pre>string</pre> | Document ID | | ||
| `body` | <pre>object</pre> | Partial content of the document to update and fields to add to the document if it gets created | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match method signature
src/controllers/Document.ts
Outdated
* @param _id Unique document identifier | ||
* @param body Partial changes to apply to the document and Fields to add to the document if it gets created (optional) | ||
* @param options | ||
* @returns {Promise<Object>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @returns {Promise<Object>} | |
* @returns Information about the updated document |
src/controllers/Document.ts
Outdated
* @param body Partial changes to apply to the document and Fields to add to the document if it gets created (optional) | ||
* @param options | ||
* @returns {Promise<Object>} | ||
* @see https://docs.kuzzle.io/sdk/js/7/controllers/document/upsert/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be between the description and params description
src/controllers/Document.ts
Outdated
collection: string, | ||
_id: string, | ||
body: JSONObject, | ||
options: {refresh?: string, retryOnConflict?: boolean, source?: boolean} = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retryOnConflict
is not added to the request. Since this is a common argument, you should check for it's presence in the Kuzzle.query
method and add it if present (this bug already exists in prior version of the SDK)
--- | ||
code: true | ||
type: page | ||
title: upsert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing page description
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Adrien Maret <[email protected]>
Co-authored-by: Sébastien Cottinet <[email protected]>
# [7.5.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.5.0) (2021-01-17) #### New features - [ [#577](#577) ] Add [auth|security]:checkRights ([Yoann-Abbes](https://github.com/Yoann-Abbes)) - [ [#576](#576) ] Add document:upsert ([Yoann-Abbes](https://github.com/Yoann-Abbes)) ---
What does this PR do?
Add document:upsert API action (fix #572)