Answer the question
In order to leave comments, you need to log in
How to add object from mongodb database?
In general, I have a script that calls db.get().collection('test').updateOne() passing in the ID I need and the object that I need to add to the "chatlog" key. I tried to implement it in different ways, but I could not make the object exactly ADDED, the .updateOne method just overwrites it. It looks like this:
{
{
"_id": 123123,
"chatlog": {
"971": {
"msg": "message",
"attachments": [
],
"date": 1503212258
}
}
}
"972": {
"msg": "message2",
"attachments": [
],
"date": 1503432654
}
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