PouchDB find error: selector containing `[null]` didn't work properly
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
```javascript
it("should not match", async () => {
const db = context.db;
await db.put({ _id: '1', field: "a" });
const resp = await db.find({
selector: { field: [null] }
});
resp.docs.should.have.length(0);
});
```
Response unexpectedly contain documents:
```console
AssertionError: expected [ Array(1) ] to have a length of 0 but got 1
```
With CouchDB 3.1.2 (same used in GH CI workflows):
```bash
# database connection
db=http://admin:password@localhost:5984/test
# write document
curl -s -H "Content-Type: application/json" -X PUT $db/1 -d '{"field":"a"}' | jq .
# query database
curl -s -H "Content-Type: application/json" -X POST $db/_find -d '{"selector":{ "field":[null] }}' | jq .
```
Output:
```console
{
"ok": true,
"id": "1",
"rev": "1-3430e46f86eeba0abfef2b577225476a"
}
{
"docs": [],
"bookmark": "nil",
"warning": "No matching index found, create an index to optimize query time."
}
```
Contributor guide
Assessment
This issue has not been assessed yet.