summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgarren smith <garren.smith@gmail.com>2017-10-17 11:11:16 +0200
committerGitHub <noreply@github.com>2017-10-17 11:11:16 +0200
commit84edbb735bf0687be7da50da970c87bebe261088 (patch)
treef4a9c4e517254687b589a3f1ad03fd293c25311a
parent641aa568d011100aacdee6128da51b5a98fdbd8f (diff)
downloadcouchdb-84edbb735bf0687be7da50da970c87bebe261088.tar.gz
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
-rw-r--r--src/mango/test/16-index-selectors.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mango/test/16-index-selectors.py b/src/mango/test/16-index-selectors.py
index 3ce659ecf..456b396c7 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)