-
Notifications
You must be signed in to change notification settings - Fork 16
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
updateOne and updateMany Response fields #168
Comments
@kathirsvn @amorton Can you confirm on the upsertedId? I thought we discussed this field to have document id if we created a new document, because upsert flag set to true in request and no document found in DB for the given filter condition. |
@amorton Does this count going to be number of records read from the database based on the filter, if limit is 20 we read max of 20 records. If we need documents for the matched criteria we need to run count query separately. |
@maheshrajamani yes you are correct. Let me fix the description of |
I have added a note to the description that the source of truth is the API spec, all commands now how a response section see https://github.com/stargate/jsonapi/blob/main/docs/jsonapi-spec.textile#commands
@maheshrajamani It will always be the number of rows we read from the filter including the limit, we will not nun a seperate query to get the total. If this is not clear in the spec let me know https://github.com/stargate/jsonapi/blob/main/docs/jsonapi-spec.textile#commands |
Currently, updateOne and updateMany Response fields are missing some of the counts required.
Here's a sample response:
{"status":{"updatedIds":["7505ffec-47a0-4346-8ee3-72fd70ad09e5"]
}}But it's supposed to have below fields:
updateOne
- always 1 in the case of updateOne and a document is found for the given filterupdateMany
- its the number of docs that matched the criteriaupdateOne
- 1 in the case when a document is found and the modification is applied and 0 if any modification was not needed/appliedupdateMany
- Number of docs the modification has been applied on.upsert
option is present and set totrue
in the request and no doc is found for the given filter and a new doc is inserted -the _id of the new doc inserted
When either the
upsert
option is not present in the request or if it's set tofalse
, this field should not be included in the response orundefined
in other words.This is applicable for both
updateOne
andupdateMany
Aaron Morton - Please use the description of the response data in the specification, not the table above https://github.com/stargate/jsonapi/blob/main/docs/jsonapi-spec.textile#commands
The text was updated successfully, but these errors were encountered: