ahmed349
ahmed3492w ago

cant connect to mongo atlas via official driver or mongoose but works outside of deno

i tried to connect to atlas through the connection string provided by them and the default example code, it works perfectly fine using node, but when i use deno the connection times out and i cannot connet using either libraries to atlas, i have gone through countless github issues mentioning the same problem but none provided a clear solution, even though each and every issue ended up with saying that the problem has been fixed in a certain update, iam on the latest version of deno, mongodb/mongoose, but i still cant connect to atlas
1 Reply
ahmed349
ahmed349OP2w ago
import mongoose from "npm:mongoose";

const uri = 'mongodb+srv://no:u@no.u.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0'

async function run() {
await mongoose.connect(uri, {dbName: "sample_mflix"});
}

run().catch(console.dir);
import mongoose from "npm:mongoose";

const uri = 'mongodb+srv://no:u@no.u.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0'

async function run() {
await mongoose.connect(uri, {dbName: "sample_mflix"});
}

run().catch(console.dir);
code used by mongoose I am not sure how this relates to the issue at hand, could you clarify