Closed Rob--W closed 11 years ago
Looking into this now
Hi, the problem is with the formation of your query: http://jsfiddle.net/RZJcJ/1/
I'm updating the api, to accept different types of queries, which should make your second query work. At the moment, if you are using $and/$or/$not/$nor
then you can't have any query parameters outside of those, parent key names.
For your first query, the $or
is incorrectly nested.
Here is a working version:
res1 = Col.query
$and:
equ: 'ok'
$or:
same: 'ok'
res2 = Col.query
$and:
equ: 'bogus' # This item is clearly unavailable
$or:
same: 'ok'
@davidgtonge Yout "working" queries are changing the structure of the query. My demo was a simplified case of a complex query.
The first query ought to demonstrate that the following -incorrectly- results in an empty list:
$and: alwaystrue
$or:
something: alwaystrue
another: alwaystrue
Ok, the issue is nested $or,$and,$not,$nor
queries.
I've not used these before, but they are part of the mongo spec - so I'm including your fix in the next version.
Basic logic is not functioning in your API, see these tests: http://jsfiddle.net/RZJcJ/