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.