davisp commented on a change in pull request #816: Fix mango json index
selection
URL: https://github.com/apache/couchdb/pull/816#discussion_r139482797
##########
File path: src/mango/test/05-index-selection-test.py
##########
@@ -92,6 +91,80 @@ def test_invalid_use_index(self):
else:
raise AssertionError("bad find")
+ def test_uses_all_docs_when_fields_do_not_match_selector(self):
+ # index exists on ["company", "manager"] but not ["company"]
+ # so we should fall back to all docs (so we include docs
+ # with no "manager" field)
+ selector = {
+ "company": "Pharmex"
+ }
+ docs = self.db.find(selector)
+ self.assertEqual(len(docs), 1)
+ self.assertEqual(docs[0]["company"], "Pharmex")
+ self.assertNotIn("manager", docs[0])
+
+ resp_explain = self.db.find(selector, explain=True)
+ self.assertEqual(resp_explain["index"]["type"], "special")
+
+
Review comment:
Too many blank lines between class methods here and in a few places below.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services