code
case 'setup':
let serverSetup = ServerDoc.findOne({id: message.guild.id})
if(serverSetup) return console.log(serverSetup)
if(!serverSetup){
let newServersetup = new ServerDoc({name: message.guild.name})
newServersetup.save();
console.log(newServersetup)
}
error
https://pastecord.com/zutetugymo
because I couldn’t paste here
>Solution :
What you think is your error is actually the result of the ServerDoc.findOne(). Since you are not using await or .then() when you are finding a document from your collection, this is what you get when you use .findOne(). To actually get the data instead of this, you just have to change your code to this:
case 'setup':
let serverSetup = await ServerDoc.findOne({id: message.guild.id})
if(serverSetup) return console.log(serverSetup)
if(!serverSetup){
let newServersetup = new ServerDoc({name: message.guild.name})
newServersetup.save();
console.log(newServersetup)
}