You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/10/17 09:11:19 UTC

[couchdb] branch master updated: Add test to show selector works with old design docs (#893)

This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 84edbb7  Add test to show selector works with old design docs (#893)
84edbb7 is described below

commit 84edbb735bf0687be7da50da970c87bebe261088
Author: garren smith <ga...@gmail.com>
AuthorDate: Tue Oct 17 11:11:16 2017 +0200

    Add test to show selector works with old design docs (#893)
    
    Add a test to show the parital_filter_selector functionality will work
    with design docs that don't have a selector defined in it by default
---
 src/mango/test/16-index-selectors.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/mango/test/16-index-selectors.py b/src/mango/test/16-index-selectors.py
index 3ce659e..456b396 100644
--- a/src/mango/test/16-index-selectors.py
+++ b/src/mango/test/16-index-selectors.py
@@ -73,6 +73,28 @@ DOCS = [
     },
 ]
 
+oldschoolnoselectorddoc = {
+    "_id": "_design/oldschoolnoselector",
+    "language": "query",
+    "views": {
+        "oldschoolnoselector": {
+            "map": {
+                "fields": {
+                    "location": "asc"
+                }
+            },
+            "reduce": "_count",
+            "options": {
+                "def": {
+                    "fields": [
+                        "location"
+                    ]
+                }
+            }
+        }
+    }
+}
+
 oldschoolddoc = {
     "_id": "_design/oldschool",
     "language": "query",
@@ -178,6 +200,14 @@ class IndexSelectorJson(mango.DbPerClass):
         resp = self.db.find(selector, explain=True)
         self.assertEqual(resp["index"]["name"], "NotSelected")
 
+    def test_old_selector_with_no_selector_still_supported(self):
+        selector = {"location": {"$gte": "FRA"}}
+        self.db.save_doc(oldschoolnoselectorddoc)
+        resp = self.db.find(selector, explain=True, use_index='oldschoolnoselector')
+        self.assertEqual(resp["index"]["name"], "oldschoolnoselector")
+        docs = self.db.find(selector, use_index='oldschoolnoselector')
+        self.assertEqual(len(docs), 3)
+
     def test_old_selector_still_supported(self):
         selector = {"location": {"$gte": "FRA"}}
         self.db.save_doc(oldschoolddoc)

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].