Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
willholley committed Oct 5, 2017
1 parent 3b5bda4 commit 5cf449a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/mango/src/mango_idx.erl
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ recover(Db) ->


has_use_index(Opts) ->
erlang:display(<<"sort opts">>),
erlang:display(Opts),
case lists:keyfind(sort, 1, Opts) of
{use_index, _} ->
true;
Expand Down
16 changes: 16 additions & 0 deletions src/mango/test/02-basic-find-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ def test_sort_desc_complex(self):
desc_companies = sorted(companies_returned, reverse=True)
self.assertEqual(desc_companies, companies_returned)

def test_sort_desc_complex_error(self):
try:
self.db.find({
"company": {"$lt": "M"},
"$or": [
{"company": "Dreamia"},
{"manager": True}
]
}, sort=[{"company":"desc"}])
except Exception as e:
self.assertEqual(e.response.status_code, 400)
resp = e.response.json()
self.assertEqual(resp["error"], "no_usable_index")
else:
raise AssertionError("expected find error")

def test_fields(self):
selector = {"age": {"$gt": 0}}
docs = self.db.find(selector, fields=["user_id", "location.address"])
Expand Down

0 comments on commit 5cf449a

Please sign in to comment.