0
const keyv = new Keyv(process.env.mongo);
wait(3000)

keyv.on('error', err => console.error('Keyv connection error:', err));
const delay = ms => new Promise(res => setTimeout(res, ms));

function wait(ms){
   var start = new Date().getTime();
   var end = start;
   while(end < start + ms) {
     end = new Date().getTime();
  }
}

wait(3000)
const inventory = new Keyv(process.env.mongo, { collection: 'inventory' })
wait(3000)
  
const daily = new Keyv(process.env.mongo, { collection: 'daily' })
wait(3000)

const wallet = new Keyv(process.env.mongo, { collection: 'wallet' })
wait(3000)

const bank = new Keyv(process.env.mongo, { collection: 'bank' })
wait(3000)

const location = new Keyv(process.env.mongo, { collection: 'location' })
wait(3000)

const userbase = new Keyv(process.env.mongo, { collection: 'userbase' })
wait(3000)

const travelcount = new Keyv(process.env.mongo, { collection: 'travelcount' })

I've got a MongoDB database using keyv to store data, however, I keep getting the following connection error: MongoNetworkError: connection 2 to 18.185.185.208:27017 closed Does anyone, by any chance, know what prevents it from connecting and/or how to fix it?

kyan_0045
  • 3
  • 2

0 Answers0