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

Return false for empty list #511

Merged
merged 1 commit into from
May 10, 2017
Merged

Return false for empty list #511

merged 1 commit into from
May 10, 2017

Conversation

garrensmith
Copy link
Member

@garrensmith garrensmith commented May 9, 2017

Overview

Currently if we have a document like this:

doc = {
  name: 'Garren',
  activities: []
};

and then create a selector like this:

find({selector: {
   activities: {
      $allMatch: {
        ['fishing', 'golf']
     }
   }
});

CouchDB mango will return the above document. This doesn't seem correct since it doesn't actually match the $allMatch selector. This PR changes that so that an empty document is false.

Testing recommendations

There is an additional test added to the Mango tests to prove this works.

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
  • I will not forget to update rebar.config.script
    with the correct commit hash once this PR get merged.

The $allMatch selector returns false for a document with an empty list
Copy link
Member

@davisp davisp left a comment

Choose a reason for hiding this comment

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

+1. $allMatch hasn't been released yet so this is fine to change without version worries.

@garrensmith garrensmith merged commit 0460a70 into apache:master May 10, 2017
@garrensmith garrensmith deleted the allmatch-false-for-empty-list branch December 12, 2019 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants