Having trouble passing parameters/setting nested fields in a raw mode Firestore Update query

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:

I think it must be complaining about the way I'm referencing the variables, but I see no other way of defining the variables in the code?

Please point me in the right direction, thanks!

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:

var newObj = {};
newObj.billDoctor = billmd;
newObj.billOptom = billopt;
newObj.billPharm = billpharm;

var data = {};
data.defaultBilling = newObj;

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.