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

312
Views
El código de conexión a la base de datos MongoDB da error: Error: querySrv ENODATA _mongodb._tcp.cluster0.h5prp.mongodb.net

Estoy codificando un bot de discordia y quiero conectarlo a una base de datos mongoDB. Sin embargo, al hacer esto, me sale este error,

 Error: querySrv ENODATA _mongodb._tcp.cluster0.h5prp.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (node:dns:228:19) { errno: undefined, code: 'ENODATA', syscall: 'querySrv', hostname: '_mongodb._tcp.cluster0.h5prp.mongodb.net' }

Aquí está mi código:

 client.on('ready', () => { console.log('The bot is ready!') const dbOptions = { // These are the default values keepAlive: true } new WOKCommands(client, { // The name of the local folder for your command files commandsDir: path.join(__dirname, 'commands'), // Allow importing of .ts files if you are using ts-node typeScript: true, // Pass in the new dbOptions dbOptions, // Pass in your own mongo connection URI mongoUri: 'mongodb+srv://discordbot:******@cluster0.h5prp.mongodb.net/myFirstDatabase?retryWrites=true&w=majority' }) })

Revisé la documentación y otras publicaciones, pero no pude encontrar nada que resuelva mi problema. Estoy usando Node.js v17.1.0. Estoy usando WOKCommands y siguiendo esta serie de tutoriales https://youtube.com/playlist?list=PLaxxQQak6D_f4Z5DtQo0b1McgjLVHmE8Q

He permitido que todas las direcciones IP accedan a mi base de datos, me he asegurado de que mi dirección IP esté en la lista blanca

Cualquier ayuda apreciada.

Gracias

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Necesitaba cambiar el URI de conexión de mongoDB a una versión anterior de Node.js.

Lo cambié a la versión '2.2.12 o posterior' y funcionó. conexión mongoDB

Que juego me un enlace como este: mongodb://discordbot:<password>@cluster0-shard-00-00.h5prp.mongodb.net:27017,cluster0-shard-00-01.h5prp.mongodb.net:27017,cluster0-shard-00-02.h5prp.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-g86xz1-shard-0&authSource=admin&retryWrites=true&w=majority

about 4 years ago · Juan Pablo Isaza Report
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!