couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [09/17] couchdb-mango git commit: Fix $all operator
Date Wed, 26 Aug 2015 16:39:10 GMT
Fix $all operator

The $all operator was only returning docs where the field exactly
matched the array. It should return docs where the provided matching
array is a subset of the field's array.
Ex: {"field" :
        { "$all" : ["Bob", "Joe"] }
    }
should match "field" : ["Bob", "Jane", "Joe"]

BugzId:46731


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/e80608da
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/e80608da
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/e80608da

Branch: refs/heads/2787-merge-repos
Commit: e80608da4f51ce787343a6721a4c44d1f489373c
Parents: cdc9fe5
Author: Tony Sun <tony.sun@cloudant.com>
Authored: Tue Aug 25 13:18:07 2015 -0700
Committer: Tony Sun <tony.sun@cloudant.com>
Committed: Tue Aug 25 13:24:04 2015 -0700

----------------------------------------------------------------------
 src/mango_selector_text.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/e80608da/src/mango_selector_text.erl
----------------------------------------------------------------------
diff --git a/src/mango_selector_text.erl b/src/mango_selector_text.erl
index 9402cc2..5eb237f 100644
--- a/src/mango_selector_text.erl
+++ b/src/mango_selector_text.erl
@@ -71,7 +71,7 @@ convert(Path, {[{<<"$all">>, Args}]}) ->
         _ ->
             % Otherwise the $all operator is equivalent to an $and
             % operator so we treat it as such.
-            convert(Path, {[{<<"$eq">> , Args}]})
+            convert([<<"[]">>| Path], {[{<<"$and">>, Args}]})
     end;
 
 % The $elemMatch Lucene query is not an exact translation


Mime
View raw message