I'm trying to assign a value as the key of an array in MongoDB.
The value I want to use is stored in a variable:
var value = "arrayKey"
and my goal is to update a MongoDB collection by setting this value as a key.
collection.update(
{
"schraenke.name": schrank.name
},
{
$push: {
value: {
"test": test
},
}
}
});
However, when I attempt this, the key being created is "value" instead of "arrayKey".