davidchambers opened a new issue, #5582:
URL: https://github.com/apache/couchdb/issues/5582
I have three documents in my database:
- `{"name": "foo"}`
- `{"name": "bar"}`
- `{"name": "baz"}`
I ran the following Mango query:
```json
{
"selector": {
"name": {
"$and": []
}
}
}
```
I expected all three documents to be returned, due to [vacuous truth][1].
Instead, no documents were returned.
I investigated and found code for handling [empty `$and`][2] and [empty
`$or`][3]:
```erlang
match({[{<<"$and">>, []}]}, _, _) ->
true;
```
```erlang
match({[{<<"$or">>, []}]}, _, _) ->
true;
```
Confusingly, it's actually the `$or` code that looks wrong to me. :thinking:
[1]: https://en.wikipedia.org/wiki/Vacuous_truth
[2]:
https://github.com/apache/couchdb/blob/3.5.0/src/mango/src/mango_selector.erl#L367-L368
[3]:
https://github.com/apache/couchdb/blob/3.5.0/src/mango/src/mango_selector.erl#L372-L373
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]