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

142
Views
Mongodb snapshot node

I am getting an error when using mongodb-snapshot.

    async function dumpMongo2Localfile() {
  const mongo_connector = new MongoDBDuplexConnector({
      connection: {
          uri: `mongodb://${process.env.DB_USER}:${process.env.DB_PASS}@cluster0.5i5dp.mongodb.net:27017`,
          dbname: 'myDB',
      },
  });

  const localfile_connector = new LocalFileSystemDuplexConnector({
      connection: {
          path: './backup.tar',
      },
  });

  const transferer = new MongoTransferer({
      source: mongo_connector,
      targets: [localfile_connector],
  });

  for await (const { total, write } of transferer) {
      console.log(`remaining bytes to write: ${total - write}`);
  }
}

My code is like this and I am calling this function below.

exports.backupDB=async(req,res,next)=>{
  dumpMongo2Localfile();
  
}

The error it gives is as follows

MongoServerSelectionError: getaddrinfo ENOTFOUND cluster0.5i5dp.mongodb.net
    at Timeout._onTimeout (E:\ecommerce\node_modules\mongodb-snapshot\node_modules\mongodb\lib\core\sdam\topology.js:438:30)
    at listOnTimeout (node:internal/timers:568:17)
    at processTimers (node:internal/timers:510:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) {
      'cluster0.5i5dp.mongodb.net:27017' => ServerDescription {
        address: 'cluster0.5i5dp.mongodb.net:27017',
        error: Error: getaddrinfo ENOTFOUND cluster0.5i5dp.mongodb.net
            at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26) {
          name: 'MongoNetworkError'
        },

I don't know how i can fix it. I tried all the ways but none of them worked.

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

0

That does not look like a connection string from Atlas. You can get one from the connect button on your cluster.

https://docs.atlas.mongodb.com/connect-to-cluster/#connect-to-a-cluster

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!