Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
mongooseError: Operation `chatbots.findOne()` buffering timed out after 10000ms at Timeout.<anonymous>

I was making discord bot from youtube tutorial https://youtu.be/bD75JNQfeYM but the guy who make the youtube tutorial don't want to answer my question I got an error that say

Error: Operation chatbots.findOne() buffering timed out after 10000ms at Timeout.x

here are the code this is chatbot.js

const fetch = require('node-fetch');
const client = require('../index');
const {
    findOne
} = require('../models/chatbot');
const Schema = require('../models/chatbot');

client.on('messageCreate', async (message) => {
    if (message.author.bot) return 
    await Schema.findOne({
        guild: message.guild.id
    }, async (err, data) => {
        if (!data) return;
        if (err) throw err;
        const channell = data.channel


        if (message.channel.id === channell) {
            fetch(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}&yr0n57JXpCy7aXlzFmMchuas`) 
                .then(response => response.json())
                .then(data => {
                    message.reply(`> ${data.response}`)
                }) 
        }
    })
})

and this is command for chatbot

const {
    Client,
    Message,
    MessageEmbed
} = require('discord.js');
const Schema = require('../../models/chatbot')

module.exports = {
    name: 'set-chatbot',
    /*
     * @param {Client} client 
     * @param {Message} message 
     * @param {String[]} args 
     */
    run: async (client, message, args, Discord) => {
        const channell = message.mentions.channels.first()
        if (!channell) return message.reply('Please tell me a channel!');

        Schema.findOne({
            guild: message.guild.id
        }, async (err, data) => {
            if (data) data.delete()
            new Schema({
                guild: message.guild.id,
                channel: channell.id,
            }).save();
            message.channel.send('Done!')
        })
    }
}

this mongosose

const { mongooseConnectionString } = require("../config.json");
const mongoose = require("mongoose");

module.exports = () => {
    if (!mongooseConnectionString) return;

    mongoose.connect(mongooseConnectionString, {
        useFindAndModify: true,
        useUnifiedTopology: true,
    });
};

models

const mongoose = require('mongoose')

const chatbot = new mongoose.Schema({
    guild: String,
    channel: String
})

module.exports = mongoose.model("chatbot", chatbot);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!