Replies: 2 comments 1 reply
-
This is a bug on the server side, it should return the matchedCount etc. Can you raise a bug https://github.com/stargate/jsonapi that updateOne (and other commands that support upsert) should return the same fields as when upsert is false. when we do an upsert there should be a field in the status object called (the spec is being here)
Neither, we should be getting the data we need from the server.
We should return a map of these values, all returned from the server other than acknowledged:
Again spec is behind, we need to get in sync. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@vkarpov15 @amorton @maheshrajamani
The response of
updateOne
command from the JSON API needs to be mapped to the following fields of mongoose updateOne API responseacknowledged
is always true since our API operations are synchronous and there is no fire and forget kind of requestsFor one of the tests of
updateOne
operation (without 'upsert' flag), we are getting below response.{"status":{"updatedIds":["7505ffec-47a0-4346-8ee3-72fd70ad09e5"]}}
Question 1: Does this look good if I map it as below?
If more than one record is matched, but only one record is updated, the matchedCount will still be 1?
Question 2: When there is 'upsert' flag in the request and if an upsert happened, I assume we would be getting below response.
{"status":{"upsertedId":"7505ffec-47a0-4346-8ee3-72fd70ad09e5"}}
So, in that case, is it good if I map the result as below?
Question 3: Also,
updateMany
has same signature. Is the same mapping logic applicable forupdateMany
as well?Beta Was this translation helpful? Give feedback.
All reactions