-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
RTDB and Firestore query filters (e.g., equalTo, startAt, endAt, and Firestore where queries) can behave incorrectly when the filter value is intended to be a number but is treated as a string (or vice-versa). This causes missing/incorrect matches in both RTDB and Firestore. For example, when querying Firestore for a string written as a number (e.g., a field with value "5"), queries using the number 5 will not match, and vice versa. This can lead to confusing or incorrect query results.
Steps to Reproduce
RTDB Example
- Prepare RTDB data where a child value is numeric, e.g.:
users/u1/age = 10(number)
- Run a query command that filters with value
10, which sometimes gets treated as"10"(string). - Observe results do not match expectations, especially for numeric comparisons.
Firestore Example
- Save a document field value as a string-encoded number, e.g.,
{ "value": "5" }(note the string type). - Run a filter/query with value
5(number), expecting to match, but it does not match. The inverse (string vs number) yields the same issue.
Expected Behavior
- Query filters should use the actual intended type:
equalTo(10)matches numeric10in RTDB.- Numeric
startAt/endAtperform correct numeric ordering. - Firestore queries should distinguish and respect the intended type (number vs string) for matching.
- Provide an unambiguous way to pass typed values (e.g., JSON literal input or explicit
--type number|string|boolean|null).
Actual Behavior
- Filter values may be coerced or parsed in a way that changes the type, producing incorrect results for both RTDB and Firestore queries.
- Querying with a string that looks like a number (
"5") will not match a number (5), and vice versa, even if the content is identical.
Environment
- OS: [e.g. macOS, Ubuntu]
- Node.js version: [e.g. 18.17.0]
- firebase-tools-cli version: [e.g. 0.5.1]
Additional Context
Suggested Implementation Notes
- Prefer explicit typing:
--value-json '10'vs--value-json 10- or
--value 10 --type number
- Add tests for numeric vs string stored values with
equalTo/startAt/endAt(RTDB), and for Firestore filters comparing strings that look like numbers with true numbers, both directions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working