I'd like to pass in variables defined by the user when using pouchdb's plugin, upsert. Ideally, something like this:
var res = db.upsert(uniqueID, (doc) => {
doc.data.var1.var2.var3 = userInput
}
What I've Tried:
var res = db.upsert(uniqueID, (doc) => {
doc.data = {[var1]:
{[var2]:
{[var3]: userInput}
}
}
}
This results in the contents of doc.data
being overwritten repeatedly with each new variable.
Now, is there a way to simply define a nested, variable-dependent key that I intend to upsert?
A document for every var3: userInput
seems way too excessive atm.