-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Issue connecting with MongoDB Atlas Cluster #3133
Comments
I've never used MongoDB Atlas Cluster before, but I think you need to include import * as dotenv from "dotenv";
import "reflect-metadata";
import { createConnection } from "typeorm";
dotenv.config();
createConnection({
cli: {
entitiesDir: "src/entity",
migrationsDir: "src/migration",
subscribersDir: "src/subscriber",
},
entities: [
"src/entity/**/*.ts",
],
logging: true,
migrations: [
"src/migration/**/*.ts",
],
subscribers: [
"src/subscriber/**/*.ts",
],
synchronize: true,
useNewUrlParser: true
type: "mongodb",
url: `mongodb+srv://${process.env.MONGODB_ATLAS_USERNAME}:${process.env.MONGODB_ATLAS_PASSWORD}@inquisitive-cluster-1-j18op.mongodb.net/inquisitive-db?retryWrites=true`,
}).then(async (connection) => {
console.log("Connection succesful");
console.log("Connection: ", connection);
}).catch((error) => {
console.log("Connection failed");
console.log(error);
}); |
Similar issue #2650 |
I'm seeing this as well. But the issue for me isn't just getting a warning; I can't connect via typeorm to a mongodb atlas cluster at all. What are the tricks for getting typeorm to connect to a mongodb atlas cluster? (Works fine against a local mongodb instance) |
@charlieroth if this issue is only about warning please, please see this comment #2650 (comment). If there is problem with connect to mongo atlas please check this answer #3347 (comment) Let me know if this help. |
This issue should be fixed by #3366 and will be in next release. Feel free reopen if problem persists. |
As described in [MongoDB Docs](https://docs.mongodb.com/manual/reference/connection-string/#dns-seed-list-connection-format), an additional connection string format called DNS Seed List Connection format can be used. As this is the default format for MongoDB Atlas, the hosted service of MongoDB, this should be available also for typeorm. The connection format is identified by the url-schema "mongodb+srv" and does not allow specifying a port. Fixes typeorm#3347 Fixes typeorm#3133
As described in [MongoDB Docs](https://docs.mongodb.com/manual/reference/connection-string/#dns-seed-list-connection-format), an additional connection string format called DNS Seed List Connection format can be used. As this is the default format for MongoDB Atlas, the hosted service of MongoDB, this should be available also for typeorm. The connection format is identified by the url-schema "mongodb+srv" and does not allow specifying a port. Fixes #3347 Fixes #3133
Issue type:
[x] question
[ ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[x]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[ ]
latest
[ ]
@next
[x]
0.2.9
(or put your version here)package.json:
Steps to reproduce or a small repository showing the problem:
When I run
npm start
I get the following error:I see older issues with a similar problem and was wondering if an update in the MongoDB node driver is causing this or if this is due to my configuration settings?
The text was updated successfully, but these errors were encountered: