'MongooseError: Query was already executed in discord.js
MongooseError: Query was already executed: anti-ping-log.findOne({ Guild: '443905850634010625' })
at model.Query._wrappedThunk [as _findOne] (/home/container/node_modules/mongoose/lib/helpers/query/wrapThunk.js:21:19)
at /home/container/node_modules/kareem/index.js:367:25
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
originalStack: 'Error\n' +
' at model.Query._wrappedThunk [as _findOne] (/home/container/node_modules/mongoose/lib/helpers/query/wrapThunk.js:25:28)\n' +
' at /home/container/node_modules/kareem/index.js:367:25\n' +
' at processTicksAndRejections (node:internal/process/task_queues:78:11)'
}
Whenever my discordbot is an event triggered / command is running, the error comes, see above, below then the code of the bot Can it be that it lies because I have it twice in the code? I would send my entire code, but it goes over 300 lines, and that's a bit too long But what you see should be sufficient
antiPingSchema.findOne(guild, async(err, data) => {
if(data){
const member = message.mentions.members.first()
if(member){
if(data.Member.includes(member.id)){
antiPingRoleSchema.findOne(guild, async(err, data3) =>{
if(data3){
antipingtext.findOne(guildtext, async(err, data4) =>{
if(data4){
}else if(!data4){
}
})
antipinglogchannel.findOne(guild, async(err, data2)=>{
if(data2){
}else if(!data2){
return;
}
})
}else if(!data3){
antipinglogchannel.findOne(guild, async(err, data2)=>{
if(data2){
}else if(!data2){
return;
}
})
antipingtext.findOne(guildtext, async(err, data4) =>{
if(data4){
}else if(!data4){
}
})
}
})
}
}else if(!data){
return;
}
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
