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

232
Views
No se puede conectar a MongoDB debido a un URI incorrecto

Estaba tratando de ejecutar mongoDB en el servidor de nodos Código completo aquí desde MongoDB :

Mi mongo versión: 4.4.3

Versión del nodo: v15.7.0

He importado el código de inicio de MongoDB, y este es el código:

 const { MongoClient } = require("mongodb"); // Connection URI const uri = "mongodb+srv://sample-hostname:27017/?poolSize=20&writeConcern=majority"; // Create a new MongoClient const client = new MongoClient(uri); async function run() { try { // Connect the client to the server await client.connect(); // Establish and verify connection await client.db("admin").command({ ping: 1 }); console.log("Connected successfully to server"); } finally { // Ensures that the client will close when you finish/error await client.close(); } } run().catch(console.dir);

En la terminal, cuando ejecuto "node app.js", me arroja el siguiente error:

 > (node:79653) Warning: Accessing non-existent property 'MongoError' of > module exports inside circular dependency (Use `node --trace-warnings > ...` to show where the warning was created) MongoParseError: URI does > not have hostname, domain name and tld > at parseSrvConnectionString (/home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/core/uri_parser.js:50:21) > at parseConnectionString (/home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/core/uri_parser.js:594:12) > at connect (/home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/operations/connect.js:284:3) > at /home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/mongo_client.js:225:5 > at maybePromise (/home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/utils.js:681:3) > at MongoClient.connect (/home/harmony/Desktop/FruitsProject/node_modules/mongodb/lib/mongo_client.js:221:10) > at run (/home/harmony/Desktop/FruitsProject/app.js:12:18) > at Object.<anonymous> (/home/harmony/Desktop/FruitsProject/app.js:21:1)
over 4 years ago · Santiago Trujillo
6 answers
Answer question

0

El error Accessing non-existent property 'MongoError' of > module exports inside circular dependency es causado por un error en mongodb 3.6.4

ya esta reportado aqui

Volver a la versión 3.6.3 funciona para mí:

 npm uninstall mongodb --save

Instalar la versión 3.6.3

 npm i mongodb@3.6.3
over 4 years ago · Santiago Trujillo Report

0

Para todos los que busquen esta advertencia, no se preocupen, es solo un error de versión y ya se informó. Simplemente desinstale la versión 3.6.4 e instale la versión 3.6.3 como se respondió en @kmgt answer.

Más detalles:
https://developer.mongodb.com/community/forums/t/warning-accessing-non-existent-property-mongoerror-of-module-exports-inside-circular-dependency/15411

https://github.com/Automattic/mongoose/issues/9900

over 4 years ago · Santiago Trujillo Report

0

Rebajé MongoDB según lo recomendado, pero eso por sí solo no resolvió el problema.

Tuve que degradar mangosta también para eliminar el error.

Bajé a:

MongoDB versión 3.6.3 Mangosta versión 5.11.15

over 4 years ago · Santiago Trujillo Report

0

No tiene que degradar su MongoDB, solo degradar su paquete mongoose a 5.11.15 como se menciona en esta mención: https://github.com/Automattic/mongoose/issues/9900#issuecomment-778535254 Estoy usando Mongo v4. 4.3 y solo downgrade mongoose funcionó para mí.

over 4 years ago · Santiago Trujillo Report

0

También tengo un error similar, estoy ejecutando en MacOS Catelina:

(node:3265) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) Server started on port 3000

Ejecutándose anteriormente en:

nodo: v14.15.4, mongodb: v4.4.3, mangosta: v5.11.18

Después de degradar mongoose a v5.11.15, el error desapareció.

  1. Desinstalar mongoose de la terminal
    npm uninstall mongoose

  2. Instale mangosta versión 5.11.15
    npm i mongoose@5.11.15

over 4 years ago · Santiago Trujillo Report

0

[error mongo 1

debido a la línea que muestro en un rectángulo rojo sobre la imagen

over 4 years ago · Santiago Trujillo 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!