Skip to content

🐛 [firestore] Not able to filter/query on fields that are null #11874

Closed
@puf

Description

@puf

Bug report

I have a query that tries to retrieve documents with a (date) field that has a null value.

const query = FirebaseFirestore.instance.collection("77468864").where("date", isEqualTo: null);
var snapshot = await query.get();
print('Got snapshot with ${snapshot.size} documents');

The Flutter code (when run on web, I didn't test other platforms) incorrectly returns documents with an actual date value, while the corresponding JavaScript code does not return these documents.

Steps to reproduce

  1. I have a collection with one document that has two fields (date and string), both of which have a value.
  2. Go to https://zapp.run/edit/firestore-query-null-date-zr1q06yyr1r0
  3. Check the log output to see that the code returns a document with a non-null date field
  4. Go to https://stackblitz.com/edit/firestore-v9-query-null-date?file=index.js
  5. Check the log output to see that the code returns no documents

Expected behavior

I expect the Flutter and JavaScript projects to show the same result, given that they run an equivalent query on the same data.


Additional context

Originally reported here: https://stackoverflow.com/q/77468864

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions