nestjs / mongoose

Mongoose module for Nest framework (node.js) 🍸
https://nestjs.com
MIT License
521 stars 117 forks source link

Unable to connect for non-SSL connections when specifying dbName in URI #1935

Closed DevHusariaSolutions closed 1 year ago

DevHusariaSolutions commented 1 year ago

Is there an existing issue for this?

Current behavior

I've created new DB. I'm able to connect to it via Mongo Compass. I'm unable using this package specyfing only uri as:

MongooseModule.forRoot(DATABASE_URL)

getting error ERROR [MongooseModule] Unable to connect to the database. Retrying

but if I remove dbName after slash from DATABASE_URL and use code below

MongooseModule.forRoot(DATABASE_URL, { dbName: 'my-db-name' })

It works

Wasted more hours than I could, so minimal info

Minimum reproduction code

-

Steps to reproduce

No response

Expected behavior

it connects correctly for uri with dbname

Package version

10.0.1

mongoose version

7.6.1

NestJS version

10.2.7

Node.js version

18.18

In which operating systems have you tested?

Other

No response

kamilmysliwiec commented 1 year ago

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.