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

Support dot notation with $pop update operation #193

Merged
merged 3 commits into from
Feb 25, 2023

Conversation

tatu-at-datastax
Copy link
Contributor

What this PR does:

Changes $pop implementation to support dotted paths too.

Which issue(s) this PR fixes:
Fixes #184

Checklist

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

@tatu-at-datastax tatu-at-datastax self-assigned this Feb 24, 2023
@@ -1347,6 +1413,8 @@ private void insertDoc(String docJson) {
.when()
.post(CollectionResource.BASE_PATH, keyspaceId.asInternal(), collectionName)
.then()
// Sanity check: let's look for non-empty inserted id
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed because we always get 200 response; failure indicated differently so need to get inserted-id.
(not checking masked a few failures within invalid json being sent)

@tatu-at-datastax tatu-at-datastax changed the title (WIP) Support dot notation with $pop update operation Support dot notation with $pop update operation Feb 24, 2023
@tatu-at-datastax tatu-at-datastax marked this pull request as ready for review February 24, 2023 22:42
@tatu-at-datastax tatu-at-datastax requested a review from a team as a code owner February 24, 2023 22:42
Copy link
Contributor

@maheshrajamani maheshrajamani left a comment

Choose a reason for hiding this comment

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

LGTM


// Otherwise must be an array
if (value.isArray()) { // Already array? To modify unless empty
if (!value.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting we have handled empty array. I just tested it with insert and find, it works!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok good -- I thought it should but is good to confirm. Mongo array operators are pretty useful.

@tatu-at-datastax tatu-at-datastax merged commit d6da0cb into main Feb 25, 2023
@tatu-at-datastax tatu-at-datastax deleted the tatu/184-dot-notation-for-pop branch February 25, 2023 03:10
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.

Support nested path ("dot notation") for $pop operator
2 participants