Goal
- I'm trying to pass information from a query to a Firebase Raw mode query. I have to use Firebase Raw mode because I'm trying to increment a value (so I want to use
firestore.FieldValue.increment(n)
- which is working great!) - However, I can't figure out how to access variables/other queries/form data from my Firebase query in raw mode - every time I do, I get
SyntaxError: Unexpected token '{'
Steps
-
When I do my Firebase query with purely static data, it works fine e.g. I can run something like:
const id = "static-id"; const amount = 3; return await db.firestore() .collection('someCollection') .doc(id) .update({ "someProperty": firestore.FieldValue.increment(amount) });
And this will happily run the query and shows the document was modified successfully.
-
But as soon as try to use a variable for the amount, or the id of the document to modify, it gives
SyntaxError: Unexpected token '{'
Details
- This seems similar to this previously reported issue: How to access variables from Firebase Raw Mode?
- But unlike in that one, no amount of swapping between GUI and Raw mode allows my query to start working
- I also tried creating a fresh query, but it didn't seem to help
- None of the "pre-populated examples" show how to use data from other queries
Screenshots
I think this is a minimal reproduction?