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

795
Views
No se puede conectar con la base de datos Mongodb usando Nodejs

Estoy tratando de conectar la base de datos Mongodb con Nodejs, pero muestra el siguiente error:

 Error MongoServerSelectionError: connection <monitor> to 18.235.147.2:27017 closed at Timeout._onTimeout (D:\Backend\NodeJs\PapersBackend\node_modules\mongodb\lib\core\sdam\topology.js:438:30) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) { reason: TopologyDescription { type: 'ReplicaSetNoPrimary', setName: null, maxSetVersion: null, maxElectionId: null, servers: Map { 'cluster0-shard-00-01.ef0q5.mongodb.net:27017' => [ServerDescription], 'cluster0-shard-00-02.ef0q5.mongodb.net:27017' => [ServerDescription], 'cluster0-shard-00-00.ef0q5.mongodb.net:27017' => [ServerDescription] }, stale: false, compatible: true, compatibilityError: null, logicalSessionTimeoutMinutes: null, heartbeatFrequencyMS: 10000, localThresholdMS: 15, commonWireVersion: null } }

No puedo obtener exactamente el problema que se encuentra debajo de mi código:

 const express = require('express'); const router = express.Router(); const MongoClient = require('mongodb').MongoClient; const dburl = 'mongodb+srv://digi18:<myPasssword>@cluster0.ef0q5.mongodb.net/MyDb? retryWrites=true&w=majority'; router.use(express.json()); router.use(express.urlencoded({ extended: true })); router.post('/register',(req,res) => { MongoClient.connect(dburl,{ useNewUrlParser:true,useUnifiedTopology: true },(err,client) => { if(err){ console.log("Error",err); } else{ res.send("Connect"); } }); }); module.exports = router;

¿Qué estoy haciendo mal?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Resolví este problema simplemente haciendo acceso a la red en el panel de control de Mongodb Atlas access from anywhere para add current ip . No sé si es un problema del lado de Mongodb o si hay alguna otra salida.

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!