Issue in Node course-MongoDB

Hello all,
this course appears to be quite out of date. I had issues even installing MongoDB and had to resort to these instructions mongodb - Read-only file system when attempting mkdir /data/db on Mac - Stack Overflow

I’m now in section 4. Connecting to MongoDB, of CRUD Operations Using Mongoose and it isn’t working. Any help would be appreciated. The error I’m getting is …

could not connect to mongodb MongoParseError: Invalid scheme, expected connection string to start with “mongodb://” or “mongodb+srv://”

Thank you in advance!

I spent quite a while trying to figure out how to install MongoDB and Mongoose also. My problem was one mentioned in the Stack Overflow post you linked. That with the new macOS Catalina update, the folder /data/db is read-only, you cannot modify it, so you have to store your database files somewhere else. I had to go through the MongoDB Installation Documentation, which is summarized below.


1. To install xcode, run in your macOS Terminal:

$ xcode-select --install

2. To install brew use the official Homebrew Installation Instructions.

3. To tap the MongoDB Homebrew Tap, run in your macOS Terminal:

$ brew tap mongodb/brew

4. To update Homebrew and all existing formulae:

$ brew update

5. To install MongoDB:

$ brew install mongodb-community@5.0


To start MongoDB, run:

$ brew services start mongodb-community@5.0

To stop MongoDB, run:

$ brew services stop mongodb-community@5.0

To verify that MongoDB is running:

$ brew services list


To check where your database files are being stored run:

$ sudo lsof -p `ps aux | grep mongodb | head -n1 | tr -s ' ' | cut -d' ' -f 2` | grep REG

When I ran this command it showed that my files are being stored in a hidden file in my harddrive, Macintosh HD. In Finder you can push SHFT + CMD + . to show hidden files. If this command returns file names with a folder called mongodb, then you are good to go.

If your files are still read-only, you can try to overwrite the default storage path with:

$ mongod --dbpath /System/Volumes/Data/data/db

To verify your MongoDB version:

$ mongod --version

I replied to this several days ago and a bot hid my response so I put it on this Stack Overflow post.

If you scroll down on the post my response is the one that starts with…

“I spent quite a while trying to figure out how to install MongoDB and Mongoose. My problem with the new macOS Catalina update, the folder /data/db is read-only, you cannot modify it, so you have to store your database files somewhere else. I had to go through the MongoDB Installation Documentation, which is summarized below.”

Not sure how long until the other post gets reviewed but Stack Overflow also allowed me to include more links than I could here. Hope it helps!

Hey, maybe you guys can use mongo with docker, should be easy to do it, or more easy way just use mongo atlas, create an account, and free cluster anywhere, then mongo can provide you with a connect option which is basically the string connection to your mongo database