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 [email protected]
--------------------------------------------------------
**To start MongoDB, run:**
$ brew services start [email protected]
To stop MongoDB, run:
$ brew services stop [email protected]
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