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

434
Views
Deno Uncaught Error: No such host is known. (os error 11001)

I tried to connect the MongoDB Atlas to my Deno Application using https://deno.land/x/mongo@v0.21.2 framework. I tried the below code to run my application. but I get an error No such host is known. (os error 11001) What went wrong here

Error

error: Uncaught Error: No such host is known. (os error 11001)
    at unwrapResponse (rt\10_dispatch_json.js:24:13)
    at sendAsync (rt\10_dispatch_json.js:75:12)
    at async Object.connect (rt\30_net.js:221:13)
    at async MongoClient.connect (client.ts:41:14)
    at async mongodb.ts:33:1

Mongodb.ts File

import { MongoClient } from "https://deno.land/x/mongo@v0.21.0/mod.ts";
    
    const client1 = new MongoClient();
    await client1.connect("mongodb+srv://user1:MYPASSWORD@cluster0.hmdnu.mongodb.net/TestingDB?retryWrites=true&w=majority");
    
    const db = client1.database("TestingDB");
    
    export default db;

I used this command to run my server

deno run --allow-net --allow-write --allow-read  --allow-plugin --unstable server.ts
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I fixed this using https://www.youtube.com/watch?v=hhdhydffKKE this video reference

Follow these steps to fix this

    import { MongoClient } from "https://deno.land/x/mongo@v0.21.0/mod.ts";
    
    const client1 = new MongoClient();
    
    await client.connect({
    db: "<db>",
    tls: true,
    servers: [
      { 
        host: "<host>",
        port: 27017,
      },
    ],
    credential: {
      username: "<user>",
      password: "<password>",
      db: "<db>",
      mechanism: "SCRAM-SHA-1",
    },
  });
    
 const db = client1.database("TestingDB");
    
 export default db;

This is not mentions in the document, but this will help to fix the issue

<db> is the database name, you can get the database name by following these steps

Step-1 step -1

Step-2 step-2

To find the <host> follow these steps

Step -1 enter image description here

Step -2 enter image description here

Step -3 enter image description here

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!