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

Conversation

Projects
None yet
3 participants
@garrensmith
Member

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.
Return false for empty list
The $allMatch selector returns false for a document with an empty list
@davisp

davisp approved these changes May 9, 2017

+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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment