Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PouchDB find error: selector containing [null] didn't work properly #8901

Open
SourceR85 opened this issue Mar 30, 2024 · 0 comments
Open

PouchDB find error: selector containing [null] didn't work properly #8901

SourceR85 opened this issue Mar 30, 2024 · 0 comments

Comments

@SourceR85
Copy link
Contributor

SourceR85 commented Mar 30, 2024

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:

     AssertionError: expected [ Array(1) ] to have a length of 0 but got 1

With CouchDB 3.1.2 (same used in GH CI workflows):

# 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:

{
  "ok": true,
  "id": "1",
  "rev": "1-3430e46f86eeba0abfef2b577225476a"
}
{
  "docs": [],
  "bookmark": "nil",
  "warning": "No matching index found, create an index to optimize query time."
}
@SourceR85 SourceR85 changed the title PouchDB find error: selector containing [null] didn't work PouchDB find error: selector containing [null] didn't work properly Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant