Choosing mongodb database to use

Hola, where in the railway mongodb url do i insert the name of the database i wanna use? cant seem to get it working like the atlas one
Solution:
you are likely using the mongoose client incorrectly, please see the docs - https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.connect() you probably want to be specifying the database name as options.dbName -- not in the url...
Jump to solution
11 Replies
Percy
Percy4w ago
Please provide your project ID or reply with N/A. Thread will automatically be closed if no reply is received within 10 minutes. You can copy your project's id by pressing Ctrl/Cmd + K -> Copy Project ID.
Percy
Percy4w ago
No project ID was provided. Closing thread.
Brody
Brody4w ago
Mongoose?
Vulgaris Magistralis
Sorry i thought it got deleted. yes, moongose
Brody
Brody3w ago
what error are you getting
Vulgaris Magistralis
errorResponse: { ok: 0, errmsg: 'Authentication failed.', code: 18, codeName: 'AuthenticationFailed' }, ok: 0, code: 18, codeName: 'AuthenticationFailed', connectionGeneration: 0, [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' } that's when using the public one on my own machine (works without the db name chained and just goes to test) i'm not sure that was the exact same error the internal one was omitting, ive settled on just using the test db, but kinda anoyying
Solution
Brody
Brody3w ago
you are likely using the mongoose client incorrectly, please see the docs - https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.connect() you probably want to be specifying the database name as options.dbName -- not in the url
Vulgaris Magistralis
Ill give it a shot, it's just that it always worked for me using atlas with mongoose and is a mongo thing
Brody
Brody3w ago
as far as I know, specifying the database in the url is Atlas specific
Vulgaris Magistralis
yeah that works, probably did a really bad job searching google for that "problem" thank you
Brody
Brody3w ago
no problem!
Want results from more Discord servers?
Add your server