-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to connect to mongodb Atlas #319
Comments
https://github.com/erfanium/deno-deploy-mongo This issue needs a reproduction steps for me |
I've a simple script like this: import { MongoClient } from "https://deno.land/x/mongo@v0.29.0/mod.ts";
const client = new MongoClient();
const db = await client.connect(
"mongodb+srv://USER:PASSWORD@jok-prod.RANDOM.mongodb.net/jok?authMechanism=SCRAM-SHA-1"
);
const names = await db.listCollectionNames();
console.log(names); and it fails, I've tried the same script on different mongo atlas clusters and had the same error. Can you share the structure of the connection string you are using? Maybe I miss something there |
Ah it seems the database name in the connection string isn't supported for now. It started working once I've updated connection string like this: "mongodb+srv://USER:PASSWORD@jok-prod.RANDOM.mongodb.net/?authMechanism=SCRAM-SHA-1" |
are you sure? maybe you should use |
I've tried calling Input:
Output: {
servers: [
{ host: "jok-prod-shard-00-01.RAND.mongodb.net.", port: 27017 },
{ host: "jok-prod-shard-00-02.RAND.mongodb.net.", port: 27017 },
{ host: "jok-prod-shard-00-00.RAND.mongodb.net.", port: 27017 }
],
authSource: "admin",
replicaSet: "atlas-132kf5-shard-0",
db: "jok",
credential: {
username: "USER",
password: "PASSWORD",
db: "jok",
mechanism: "SCRAM-SHA-1"
},
compression: [],
tls: true,
retryWrites: true
} As you can see it changed credentials database as well and that's the issue here I think |
i think that's an expected behavior, just use something like: |
The reason why I think it's an issue is that the connection string I used works properly with nodejs mongo (official) driver and many users will use the same connections string and had the same issue. I think |
Hey, it works with local db but fails with mongodb atlas connection string, I'm using the syntax like this:
It always fails here: https://deno.land/x/mongo@v0.29.0/src/client.ts#L41
with error:
Can you share if it's a known issue or do I need to provide some additional params?
The text was updated successfully, but these errors were encountered: