Skip to content
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

Ports not accepted with 'mongodb+srv' URIs #64

Open
orophix opened this issue Dec 7, 2021 · 1 comment
Open

Ports not accepted with 'mongodb+srv' URIs #64

orophix opened this issue Dec 7, 2021 · 1 comment

Comments

@orophix
Copy link

orophix commented Dec 7, 2021

Sorry this is the first time I try out mongodb. What am I doing incorrectly?

Error conenction db: MongoParseError: Ports not accepted with 'mongodb+srv' URIs
    at parseSrvConnectionString (/home/vimox-api/node_modules/mongodb/lib/core/uri_parser.js:62:21)
    at parseConnectionString (/home/vimox-api/node_modules/mongodb/lib/core/uri_parser.js:611:12)
    at connect (/home/vimox-api/node_modules/mongodb/lib/operations/connect.js:283:3)
    at /home/vimox-api/node_modules/mongodb/lib/mongo_client.js:284:5
    at maybePromise (/home/vimox-api/node_modules/mongodb/lib/utils.js:692:3)
    at MongoClient.connect (/home/vimox-api/node_modules/mongodb/lib/mongo_client.js:280:10)
    at /home/vimox-api/node_modules/mongoose/lib/connection.js:836:12
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/home/vimox-api/node_modules/mongoose/lib/connection.js:832:19)
    at /home/vimox-api/node_modules/mongoose/lib/index.js:351:10
    at /home/vimox-api/node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/home/vimox-api/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)
    at Mongoose._promiseOrCallback (/home/vimox-api/node_modules/mongoose/lib/index.js:1149:10)
    at Mongoose.connect (/home/vimox-api/node_modules/mongoose/lib/index.js:350:20)
    at /home/vimox-api/src/db/connection.ts:11:20


@AlexGarrixen
Copy link
Owner

Have you set the environment variables?

It is worth mentioning that the mongodb atlas is used

The uri connection that mongo will provide you looks like this:
mongodb+srv://{username}:{password}@${host}/${database}?retryWrites=true&w=majority

You must specify the username, password, host and database in an .env or .env.development or .env.production file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants