Upsert to Vector Store with dynamic metadata

Ya I'm not sure why it's that way, annoyingly the query will still run successfully even if you do try and reference some outside variable:

It actually inserts/updates the document too, but if the metadata is invalid it overwrites whatever was in there with null or undefined... i'm not sure which

unfortunately the only workaround I've found is to have a seperate query for every metadata value and use a JS Query to run logic and decide which 'upsert' query to use. it's not a very useful workaround and i don't suggest it unless you only have a couple possibilities just because it'd be a mess/nightmare to look at, let alone keep updated for any changes made.