I have this code
for (var i = 0; i < lootbox.length; i++) {
const { type } = lootbox[i]
const query = type + "_lootbox.hunt";
await lb.findOneAndUpdate(
{ userID: message.author.id },
{ $inc: { query: 1 } }
);
}
the code reads the query as its own variable instead of the type + "_lootbox.hunt", is there a way to use that query inside the $inc? because I want to automate it using the loop
AKA. dynamic object key