Hi, I want to use a raw query so that I can update only a nested field structure in my firestore document, and want to pass parameters into the query which I can then transform into my nested structure before patching/updating the document.
I have the following code and I am getting the following syntax error running it:
OK, I worked out how to do it myself - it doesn't seem to be possible to use a Shared Query from the Query Library where the query is a raw mode query and you need to define variables.
Instead, from my app I created a manually triggered, internal to firestore query, in raw mode, where billmd, billopt, billpharm, env, document_id are variables but not referenced using curly braces:
return await db
.firestore()
.collection("clinics_"+env)
.doc(document_id)
.update(data);
And when I manually trigger the query I use additionalScope to pass the variables:
updateBilling.trigger({
additionalScope: {
env: select5.value,
document_id: record._id,
billmd: record.billDoctor,
billpharm: record.billPharm,
billopt: record.billOptom,
},
});
This works, replying here in case this is useful to others in future.