Deploying Nodejs server error

Hey can you help me with issue, firstly I got node error, then nodemon, then express and finally mondodb I dunno what’s happening I follow same rules I have did earlier that was completely fine and easier but now… MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://" Mar 4 12:56:49 AM at new ConnectionString (/opt/render/project/src/server/node_modules/mongodb-connection-string-url/lib/index.js:86:19) Mar 4 12:56:49 AM at parseOptions (/opt/render/project/src/server/node_modules/mongodb/lib/connection_string.js:204:17) Mar 4 12:56:49 AM at new MongoClient (/opt/render/project/src/server/node_modules/mongodb/lib/mongo_client.js:46:63) Mar 4 12:56:49 AM at _createMongoClient (/opt/render/project/src/server/node_modules/mongoose/lib/connection.js:851:14) Mar 4 12:56:49 AM at NativeConnection.openUri (/opt/render/project/src/server/node_modules/mongoose/lib/connection.js:705:29) Mar 4 12:56:49 AM at Mongoose.connect (/opt/render/project/src/server/node_modules/mongoose/lib/index.js:406:15) Mar 4 12:56:49 AM at connectDB (file:///opt/render/project/src/server/mongodb/connect.js:6:15) Mar 4 12:56:49 AM at startServer (file:///opt/render/project/src/server/index.js:24:11) Mar 4 12:56:49 AM at file:///opt/render/project/src/server/index.js:32:1 Mar 4 12:56:49 AM at ModuleJob.run (internal/modules/esm/module_job.js:152:23) Mar 4 12:56:49 AM Server has started at port http://localhost:8080 Mar 4 12:56:50 AM Failed to connect with MongoDB Database! Mar 4 12:56:50 AM MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://" Mar 4 12:56:50 AM at new ConnectionString (/opt/render/project/src/server/node_modules/mongodb-connection-string-url/lib/index.js:86:19) Mar 4 12:56:50 AM at parseOptions (/opt/render/project/src/server/node_modules/mongodb/lib/connection_string.js:204:17) Mar 4 12:56:50 AM at new MongoClient (/opt/render/project/src/server/node_modules/mongodb/lib/mongo_client.js:46:63) Mar 4 12:56:50 AM at _createMongoClient (/opt/render/project/src/server/node_modules/mongoose/lib/connection.js:851:14) Mar 4 12:56:50 AM at NativeConnection.openUri (/opt/render/project/src/server/node_modules/mongoose/lib/connection.js:705:29) Mar 4 12:56:50 AM at Mongoose.connect (/opt/render/project/src/server/node_modules/mongoose/lib/index.js:406:15) Mar 4 12:56:50 AM at connectDB (file:///opt/render/project/src/server/mongodb/connect.js:6:15) Mar 4 12:56:50 AM at startServer (file:///opt/render/project/src/server/index.js:24:11) Mar 4 12:56:50 AM at file:///opt/render/project/src/server/index.js:32:1 Mar 4 12:56:50 AM at ModuleJob.run (internal/modules/esm/module_job.js:152:23) Mar 4 12:56:50 AM Server has started at port http://localhost:8080

Note: they are saying I have misspelled or did any typo in MongoDB URL but nope everything is correct

1 Like

Hi,

The error is pretty clear:

expected connection string to start with "mongodb://" or "mongodb://"

You haven’t given a lot else to go on. You’ll need to check wherever you’ve set the connection string that it starts with the schemas in the error mongodb:// or mongodb://

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.