Hi, I am trying to attempt the MongoDB and Mongoose installation challenge, and I have been unable to connect Mongoose to my database on MongoDB Atlas(mLab was acquired by MongoDB).
I have whitelisted all IP addresses on mongodb Atlas, replaced my password in my .env file with passwords with no special characters, and also tried including in {useNewUrlParser: true} in my mongoose connection.
The log in glitch also displays GET messages but the console in FCC’s solution displays that I have failed to establish a connection between mongoose and a database.
Not sure if I broken something, but the log changed after I restarted my computer ( I stopped getting the GET messages)
Please refer to below for the updated log:
Could not find node 4.4.5, using 10
.env: line 10: Password123: No such file or directory
Could not find node 4.4.5, using 10
.env: line 10: Password123: No such file or directory
🐥💪 Your app is listening on port 3000
(node:1802) UnhandledPromiseRejectionWarning: MongoParseError: URI does not have hostname, domain name and tld
at parseSrvConnectionString (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb-core/3.1.11/node_modules/mongodb-core/lib/uri_parser.js:41:21)
at parseConnectionString (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb-core/3.1.11/node_modules/mongodb-core/lib/uri_parser.js:421:12)
at connect (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb/3.1.13/node_modules/mongodb/lib/operations/mongo_client_ops.js:188:3)
at connectOp (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb/3.1.13/node_modules/mongodb/lib/operations/mongo_client_ops.js:292:3)
at executeOperation (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb/3.1.13/node_modules/mongodb/lib/utils.js:420:24)
at MongoClient.connect (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongodb/3.1.13/node_modules/mongodb/lib/mongo_client.js:168:10)
at Promise (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongoose/5.4.11/node_modules/mongoose/lib/connection.js:521:12)
at new Promise (<anonymous>)
at NativeConnection.Connection.openUri (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongoose/5.4.11/node_modules/mongoose/lib/connection.js:518:19)
at Mongoose.connect (/rbd/pnpm-volume/0ee2cdcc-f3de-4003-a00a-960d49cb74bb/node_modules/.registry.npmjs.org/mongoose/5.4.11/node_modules/mongoose/lib/index.js:271:15)
at Object.<anonymous> (/app/myApp.js:13:10)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
(node:1802) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:1802) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Hi,
I think I might have made a mistake including the <> brackets in the password field. After changing my password in the database, it appears to be working now and has since passed FCC’s test.
Same problem here, I’m attempting to connect MongoDB to Mongoose and it just doesn’t work.
My code looks ok and the test confirms that the “mongodb” dependency is in package.json and that “mongoose” dependency is there, too. But then:
// running tests
mongoose is not connected
// tests completed
How should I run Mongoose on Windows 10?
I don’t see where the code would be wrong, it must be that Mongoose needs to be started somehow beforehand?!