Can't connect to mLab using Glitch console


I’ve been trying to work on FreeCodeCamp’s API projects, URL Shortener Microservice, and tried to integrate a mongodb for this project. As per FCC’s recommendations, I created an account for mLab since it allows a limited database for free.
The problem is during the testing, i’m experiencing issues on connection. Here’s the error:

2017-11-01T20:31:03.572+0000 Error: 18 { ok: 0.0, errmsg: “auth failed”, code: 18, codeName: “AuthenticationFailed” } at src/mongo/shell/db.js:1287

I’ve done some research and it mentions that the cause might be due to incompatible mongodb versions. I tried to update mongod version to 3.4.9 on glitch like the one on matlab, but it won’t let me. Does anyone know how to resolve this?


I recommend taking a look at the setup of our MongoDB example app!/mongodb and verifying you’re constructing the MongoDB url correctly and your setup is correct. You shouldn’t be needing to update mongod versions.


Hello Gareth,

I tested it and verified its working correctly using my nodejs app. Thank you for the example.

I’m assuming though that it’s not possible to connect to mongodb using the glitch console and the reason i wanted to initially was to do a quick test for the connection.


Hi @Gareth and @midnitedev101 after reading some mlab FAQs it seems that the glitch console default mongodb shell version is 2.6.10 and mlab requires version 3.0.x @Gareth is there a way to upgrade the shell version in the glitch console?

Mongo shell
If you are having trouble connecting (and authenticating) to your mLab database using the mongo shell, check to see that you are using a shell version that matches the release version of your mLab-hosted deployment. For example, if your database is running MongoDB 3.0.x, then your shell version should also be 3.0.x.