I know that this is working:
db.users.update({_id: "1234"}, {$set: {"conversations.partId": id}});
In result I've got: conversations:{"partId":2345}
but I would like to set partId as a variable. And to have structure like this:
conversations:{"3456":"2345"}
I have tried:
db.users.update({_id: "someid"}, {$set: {"conversations".partId: id}});
or
db.users.update({_id: "someid"}, {$set: {"conversations"+partId: id}});
But this is of course not working
Can anyone help me?