Answer the question
In order to leave comments, you need to log in
Why doesn't mongoose add elements to the array?
There is an entry in the database:
{
"_id" : ObjectId("56596dc1e53bfc8510abe7ee"),
"date" : {
"year_2015" : {
"month_11" : {
"moneySource" : [
{ "img" : "purse.svg", "balance" : 0, "name" : "wallet" },
{ "img" : "bank.svg", "balance" : 0, "name" : "bank" }
]
}
}
},
"__v" : 0
}
Costs.update({
"_id" : token.costs_id // 56596dc1e53bfc8510abe7ee
}, {
"$push" : {
['date.'+ year + '.' + month + '.' + post.block] : { //date.year_2015.month_11.moneySource
"name" : post.name,
"img" : post.img,
"balance": 3333333330,
}
}
}, function (err) {
if(err) {
console.log(err)
}
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question