How to push info into deep nested objects

MY FRIENDS! I DID IT!

It’s working:

const server = new Schema({
	name: String,
	icon: String,
	owner: String,
	settings: Array,
	users: Array,
	textChannels: Map,
	voiceChannels: Map
});

await serverModel.updateOne({name: serverName}, {
   $push: {[`textChannels.${channelName}.messages`]: message}
});

2.jpeg

Damn it! I’m fkin the lord of the messages! Thanks a lot to all of you. I spent billion of hours to figure it out! All of you so helped me so much! THANKS A LOT FROM THE RUSSIA WITH LOVE!

2 Likes