#how to make messages in schema
3 messages · Page 1 of 1 (latest)
create and findOneAndUpdate are both methods of mongoose models. Do you need help how to use them? Or with another part?
@tough jetty
Have a command which accepts a string option for example, and then you can use something like this,
const updated = await <schema>.findOneAndUpdate(
{
Guild: <GuildId>,
Channel: <ChannelId>
},
{
WelcomeMsg: <welcomeMsg>,
ByeMsg: <ByeMsg>
},
{
upsert: true
}
)
upsert: true adds a new document with that information if a document was not found originally