I am trying to create a new folder in the main directory
Tried all kinds of examples
sudo mkdir /data/db
sudo mkdir -p /data/db<
To add on to what David Buck wrote here, first you have to actually make the directory. You can do that with:
sudo mkdir /System/Volumes/Data/data/db
If you're getting this error:
"Error parsing command line: unrecognised option '--dbpath/System/Volumes/Data/data/db' try 'mongod --help' for more information"
after creating the alias, it's just because David Buck (while making a really helpful comment) missed a space in his answer.
To fix this, type
unalias mongod
and then type
alias mongod="sudo mongod --dbpath /System/Volumes/Data/data/db"