I would like to clarify a few things with mongodb in my node project
I have MongoDb installed and running fine on OSX Mavericks. I can create collections and query them after running mongo in my terminal.
What exactly is mongod doing when running it from the console?
When I run mongod it complains about needing a path to data/db
so I run mongod --dbpath data/db and it installs a few files to my db folder
Once I run it like this it ends with
[initandlisten] dbexit: really exiting now
I know this should be open and listening on a port. I cannot figure out why mine does not stay running. even though I clearly state the path to the data/db file.
I installed with with homebrew and the db files are stored at usr/local/var/mongodb
Am I supposed to --dbpath there or the data/db path I create in each node project?
UPDATE
I have also found that a homebrew installation will give you a mongod.conf file which sets up a different --dbpath @ usr/local/var/mongodb and it sets your mongodb server to come on at setup. Which is the reasons for errors when running mongod even when specifying a
--dbpath.
By default, the mongod process will store db data to /data/db (not data/db), which is owned by root user.
If you really want to start mongod without arguments, create the directory :
sudo mkdir -p /data/db
Then you can run mongod without --dbpath argument.
sudo mongod
I would not recommmend this solution cause using sudo can be dangerous.
Personnaly, I got a ~/data/db folder that I use for mongo process.
mongod --dbpath ~/data/db