MongoParseError: URI malformed, cannot be parsed

MongoParseError: URI malformed, cannot be parsed
at parseConnectionString (D:\Projects\mflix-js\node_modules\mongodb\lib\core\uri_parser.js:560:21)
at connect (D:\Projects\mflix-js\node_modules\mongodb\lib\operations\connect.js:282:3)
at D:\Projects\mflix-js\node_modules\mongodb\lib\mongo_client.js:223:5
at maybePromise (D:\Projects\mflix-js\node_modules\mongodb\lib\utils.js:662:3)
at MongoClient.connect (D:\Projects\mflix-js\node_modules\mongodb\lib\mongo_client.js:219:10)
at Function.connect (D:\Projects\mflix-js\node_modules\mongodb\lib\mongo_client.js:442:22)
at Object. (D:\Projects\mflix-js\src/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Module._compile (D:\Projects\mflix-js\node_modules\pirates\lib\index.js:99:24)
at Module._extensions…js (internal/modules/cjs/loader.js:1157:10)
[nodemon] app crashed - waiting for file changes before starting…

Please check the “.env” file for your connection string.

Kanika

Dear bhaskar_krishnamurthy,

please edit your env file as per your OS (win or unix) and change the value of MFLIX_DB_URI as mongodb+srv://m220student:m220password@abc.abc.mongodb.net/

now save it open cmd to that directory and type ren dotenv_win .env .
It will generate .env file that will already have your URI. Just do run npm start again. hopefully it will work.

Thanks!

4 Likes

Thanks, make me understand why i also have facing the same issue.