{username:'me', companies:{"yourcompany":{...}}
I want to insert a company into a user record (user collection), to make:
{username:'me', companies:{ "yourcompany":{...}, "mycompany":{...} }
But the name is dynamic..
var companyid = "mycompany";
.collection('users').findAndModify(
{username: usern},
[['_id', 'asc']],
{$set:{companies:{companyid: { desksmemberships:[] }}}},
{new: true}, function(){...}
Gives this.. {username:'me', companies:{ "yourcompany":{...}, "companyid":{...} }
How do I do this?