Hello @Mystic_Devs : )
The below does 3 things,keeps the channel as it was,updated the message,and removes the guilid.
Its update pipeline so you need mongoDB >=4.2.With the old update way its even simpler from this
code but pipelines updates are so powerful,so i use those.
You care for the pipeline,this part
[{"$project":{"welcome":{"channel":"$welcome.channel","message":"Hello updated!"}}}]
> use testdb
switched to db testdb
> db.testcoll.drop()
true
> db.testcoll.insert({"welcome":{"channel":"73577","message":"Hello","guildid":"75720"}});
WriteResult({ "nInserted" : 1 })
> db.testcoll.find({}).pretty();
{
"_id" : ObjectId("5f59524e2780882cafc2417b"),
"welcome" : {
"channel" : "73577",
"message" : "Hello",
"guildid" : "75720"
}
}
> db.testcoll.update({},[{"$project":{"welcome":{"channel":"$welcome.channel","message":"Hello updated!"}}}]);
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.testcoll.find({}).pretty();
{
"_id" : ObjectId("5f59524e2780882cafc2417b"),
"welcome" : {
"channel" : "73577",
"message" : "Hello updated!"
}
}
Hope it helps and good luck with your bot.