Hello, I am having a problem inserting into the database with an upsert push Meteor, I would like to have this form in my database
{
"_id" : "dnP8Hu8wouBRaZ6o5",
"userID" : "fQYGboHuxxrAu28ko",
"2020" : {
"Février" : [
12,
250,
41
]
}
}
I did this, but it registers me like this, which doesn’t suit me.
Balances.upsert(
{ userID: "fQYGboHuxxrAu28ko" },
{
$push: {
[moment().format("YYYY")]: {
[moment().format("MMMM")]: [_.sum(sommes)]
}
}
}
);
{
"_id" : "dnP8Hu8wouBRaZ6o5",
"userID" : "fQYGboHuxxrAu28ko",
"2020" : [
{
"March" : [
662.619717641257
]
},
{
"March" : [
662.65052401921
]
},
{
"March" : [
660.586191114713
]
}
]
}
Thank you for your help, I don’t know MongoDB too much