You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2017/11/23 09:26:10 UTC

[GitHub] willholley closed pull request #998: Test duplicate fields in Mango selector

willholley closed pull request #998: Test duplicate fields in Mango selector
URL: https://github.com/apache/couchdb/pull/998
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/mango/test/02-basic-find-test.py b/src/mango/test/02-basic-find-test.py
index 82554a1129..f7e151ad83 100644
--- a/src/mango/test/02-basic-find-test.py
+++ b/src/mango/test/02-basic-find-test.py
@@ -159,6 +159,18 @@ def test_multi_cond_and(self):
         assert len(docs) == 1
         assert docs[0]["user_id"] == 7
 
+    def test_multi_cond_duplicate_field(self):
+        # need to explicitly define JSON as dict won't allow duplicate keys
+        body = ("{\"selector\":{\"location.city\":{\"$regex\": \"^L+\"},"
+                "\"location.city\":{\"$exists\":true}}}") 
+        r = self.db.sess.post(self.db.path("_find"), data=body)
+        r.raise_for_status()
+        docs = r.json()["docs"]
+
+        # expectation is that only the second instance
+        # of the "location.city" field is used
+        self.assertEqual(len(docs), 15)
+
     def test_multi_cond_or(self):
         docs = self.db.find({
                 "$and":[


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services