title: HOW TO FIX Mongoose 5.11.8 model.find() ERROR Operation `thanks-leaderboards.find()` buffering timed out after 10000ms
body: <p>How to solve model.find() function produces &quot;buffering timed out after ... ms&quot;? I'm using mongoose v 5.11.8, npm v6.14.8 and mongodb v3.6.3</p>
  <p>Here's the code.</p>
  <p>thanks-leaderboard.js</p>
  <pre><code>const thanksLeaderboardSchema = require('../../schemas/thanks-leaderboard-schema.js')
  const thanksSchema = require('../../schemas/thanks-schema.js')
  
  const fetchTopMembers = async (guildId) =&gt; {
    let text = ''
  
    const results = await thanksSchema
      .find({
        guildId,
      })
      .sort({
        received: -1,
      })
      .limit(10)
  
    for (let counter = 0; counter &lt; results.length; ++counter) {
      const { userId, received = 0 } = results[counter]
  
      text += `#${counter + 1} &lt;@${userId}&gt; with ${received} thanks\n`
    }
  
    text += '\nThis is updated every minute'
  
    return text
  }
  
  const updateLeaderboard = async (client) =&gt; {
  
    const results = await thanksLeaderboardSchema.find({}).where('channelId')
    
    for (const result of results) {
      const { channelId, _id: guildId } = result
  
      const guild = client.guilds.cache.get(guildId)
      if (guild) {
        const channel = guild.channels.cache.get(channelId)
        if (channel) {
          const messages = await channel.messages.fetch()
          const firstMessage = messages.first()
  
          const topMembers = await fetchTopMembers(guildId)
  
          if (firstMessage) {
            firstMessage.edit(topMembers)
          } else {
            channel.send(topMembers)
          }
        }
      }
    }
  
    setTimeout(() =&gt; {
      updateLeaderboard(client)
    }, 1000 * 60)
  }
  
  module.exports = async (client) =&gt; {
    updateLeaderboard(client)
  }
  </code></pre>
  <p>set-leaderboard.js</p>
  <pre><code>const leaderBoardSchema = require('../../schemas/thanks-leaderboard-schema.js')
  
  
  module.exports = {
  
      commands: 'setleaderboard',
      requiredRoles: ['Administrator'],
      description: 'Erstelle ein Leaderboard für die vergebenen Danksagungen',
      callback: async (message) =&gt; {
  
          const { guild, channel} = message
          const guildId = guild.id
          const channelId = channel.id
  
          await leaderBoardSchema.findOneAndUpdate({
              
              _id: guildId,
              channelId,
            },
  
            {
              _id: guildId,
              channelId,
            },
  
            {
              upsert: true,
            })
  
            message.reply('Leaderboard wurde erstellt!').then((message) =&gt; {
              message.delete({
                timeout: 1000 * 5,
              })
            })
            message.delete()
      }
  }
  </code></pre>
  <p>thanks-leaderboard-schema.js</p>
  <pre><code>const mongoose = require('mongoose')
  
  const reqString = {
    type: String,
    required: true,
  }
  
  const thanksLeaderboardSchema = mongoose.Schema({
    // Guild ID
    _id: reqString,
    channelId: reqString,
  })
  
  module.exports = mongoose.model('thanks-leaderboards', thanksLeaderboardSchema, 'thanks-leaderboards')
  </code></pre>
  <p>thanks-schema.js</p>
  <pre><code>const mongoose = require('mongoose')
  
  const reqString = {
    type: String,
    required: true,
  }
  
  const thanksSchema = mongoose.Schema({
    userId: reqString,
    guildId: reqString,
    received: {
      type: Number,
      default: 0,
    },
    lastGave: Date,
  })
  
  module.exports = mongoose.model(
    'thanks',
    thanksSchema,
    'thanks'
  )
  </code></pre>
  <p>I tried increasing the bufferTimeoutMS or disabling the bufferCommands but still it won't work. This Code is supposed to readout the database every 60 seconds but the timeout happens after 10 seconds... can't figure out how to fix this error. I've already tried to delete the node_modules folders for mongoose and mongodb and reinstall them via npm but that didn't work as I get this error again.</p>