Skip to content
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

findOneAndUpdate() and findOneAndReplace() to return document when no data change #392

Merged
merged 3 commits into from
Apr 24, 2023

Conversation

maheshrajamani
Copy link
Contributor

@maheshrajamani maheshrajamani commented Apr 24, 2023

What this PR does:
findOneAndUpdate() return document when no data change
Which issue(s) this PR fixes:
Fixes #390

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@maheshrajamani maheshrajamani requested a review from a team as a code owner April 24, 2023 13:41
@maheshrajamani maheshrajamani changed the title findOneAndUpdate() return document when no data change findOneAndUpdate() and findOneAndReplace() to return document when no data change Apr 24, 2023
@@ -176,7 +175,7 @@ public void byIdWithIdNoChange() {
.post(CollectionResource.BASE_PATH, namespaceName, collectionName)
.then()
.statusCode(200)
.body("data.docs", hasSize(0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe change to check hasSize(1) (to prevent accepting returning multiple documents)

.post(CollectionResource.BASE_PATH, namespaceName, collectionName)
.then()
.statusCode(200)
.body("data.docs[0]", jsonEquals(document))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for hasSize(1) as well?

Copy link
Contributor

@tatu-at-datastax tatu-at-datastax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added minor suggestions for testing returned document counts.

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@maheshrajamani maheshrajamani merged commit f6d32f1 into main Apr 24, 2023
@maheshrajamani maheshrajamani deleted the return-document-no-change branch April 24, 2023 18:56
vkarpov15 added a commit to stargate/stargate-mongoose that referenced this pull request Apr 25, 2023
kathirsvn pushed a commit to stargate/stargate-mongoose that referenced this pull request Apr 25, 2023
* support sort with `find()`

* add sort to findOne(), findOneAndUpdate(), findOneAndReplace()

* quick fix for tests

* add findOneAndDelete(), count() implementation

* quick indent fix, skip test for stargate/data-api#392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

findOneAndUpdate() seems to not return result if no updates to apply
3 participants