-
Notifications
You must be signed in to change notification settings - Fork 991
Open
Description
Operating System
macOS
Browser Version
Safari 16.5.2
Firebase SDK Version
10.4.0
Firebase SDK Product:
Firestore
Describe your project's tooling
index.html with source tag. Just javascript.
Describe the problem
It's a feature request. I'd like the ability to be able to serialize and deserialize a Query. There are classes on the Auth package that have a fromJson and toJson methods, for example. I'd like to be able to reconstruct a Query from a string.
I also created a discussion for alternative solutions in the meantime (if this ever gets implemented).
Steps and code to reproduce issue
Given that I have any query, for example
import { collection, query, where } from "firebase/firestore";
const citiesRef = collection(db, "cities");
// Create a query against the collection.
const q = query(citiesRef, where("state", "==", "CA"));
I'd like to be able to do something like
const serialized = JSON.stringify(q);
const q2 = Query.fromJson(JSON.parse(serialized));//query from json