I'm trying to update an array in my collection with this:
 var str = "list.0.arr";
    db.collection('connect').update({_id: id}, {$push:  { `${str}`: item}}); 
This exact string works just fine if I do it like this:
db.collection('connect').update({_id: id}, {$push:  { "list.0.arr": item}}); 
This is to show that it works, but It's throwing an error Unexpected token when I use the first solution.
My question is, how can I get the top solution to work as the Object key?
 
     
     
    