I have problems with the database when I do a deploy.

I have a mongo DB database that is connected to a node js, to connect to mongo I use the url that mongo gives me:


the thing is that it creates a database called "test" and not "my data".

already used this form: mongodb://mongo:[my-data]@containers-us-west-184.railway.app:5712/my_db
but it does not work for me

I get this error:

MongoServerError: Authentication failed.

at Connection.onMessage (/app/node_modules/mongodb/lib/cmap/connection.js:202:26)

at MessageStream.<anonymous> (/app/node_modules/mongodb/lib/cmap/connection.js:61:60)

at MessageStream.emit (node:events:513:28)

at processIncomingData (/app/node_modules/mongodb/lib/cmap/message_stream.js:124:16)

at MessageStream._write (/app/node_modules/mongodb/lib/cmap/message_stream.js:33:9)

at writeOrBuffer (node:internal/streams/writable:391:12)

at _write (node:internal/streams/writable:332:10)

at MessageStream.Writable.write (node:internal/streams/writable:336:10)

at Socket.ondata (node:internal/streams/readable:754:22)

at Socket.emit (node:events:513:28) {

ok: 0,

code: 18,

codeName: 'AuthenticationFailed',

connectionGeneration: 0,

[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }


npm WARN config production Use --omit=dev instead.

Looking for more? Join the community!