Home > Back-end >  I'm make a discord bot and i need to make command to delete all user from database I'm use
I'm make a discord bot and i need to make command to delete all user from database I'm use

Time:01-11

I'm try this but this delete only one user i need to delete all users on the database

JailSchema.findOneAndDelete(
  {
    guildId: interaction.guild.id,
  },
  (err, res) => {
    if (err) console.log(err);
    console.log("Done");
  }
);

CodePudding user response:

You are using a mongoose function literally called findOneAndDelete, instead use the deleteMany function and give it the same identifier, should work the same but it won't limit itself to 1.

  • Related