I'm installing MongoDB for a Node / Express tutorial and upon creation of the /data/db folder and the following command:
sudo chown 'id -u' /data/db
I received the following error:
chown: id -u: illegal user name
You can look for the current username and then try setting the permissions.
$ whoami
username
$ sudo chown username /data/db
Hope that helps.