2

I had MongoDB up and running and confirmed that the databases were being added and accessed via RoboMongo on Port 27017. All the database files were being accessed in /data/db.

I tried to create a new database and could not get it created. I double checked the mongod.conf file with cat mongod.conf. It seems to have the original Homebrew setup info:

 systemLog:
    destination: file
    path: /usr/local/var/log/mongodb/mongo.log
    logAppend: true
 storage:
    dbPath: /usr/local/var/mongodb
 net:
     bindIp: 127.0.0.1

I changed the db path a second time to /data/db with mongod --dbpath /data/db. Still nothing. I also noticed a mongod.lock file witha size of 4B. I run mongod and inside the Terminal, it says the journal dir=/data/db/journal, recover : no journal files present, no recovery needed and dbpath=/data/db.

I was still having trouble with adding and also accessing the databases with a basic Mongoose connection via Robomongo on the local port 27017. I can't access the databases inside of /data/db. With ps aux | grep mongod, I found two instances running even after I shut down mongod:

376  0.0  0.3  2718944  25140   ??  S     8:45PM   0:04.87 /usr/local/opt/mongodb/bin/mongod --config /usr/local/etc/mongod.conf

863   0.0  0.0  2452228    700 s005  S+    9:58PM   0:00.01 grep mongod
Mark A
  • 1,995
  • 4
  • 18
  • 26
  • I did not back them up. They are still available in the folder – Mark A Apr 05 '16 at 02:03
  • The databases are inside of /data/db. I configured it that way and it was working. Please read the info above. As for `/usr/local/var/mongodb`, that is set by Homebrew when installed, but I changed it to /data/db – Mark A Apr 05 '16 at 02:15

1 Answers1

0

I killed mongod process in the Activity Monitor. I then removed the lock file and restarted mongodb with mongod --dbpath /data/db --repair, as per the docs. I now see the databases that I had inside of /data/db. I see the collections and databases I created before

I was using the principle of coding small successes, which threw me off. My problem of adding new databases was solved by adding collections, so Mongo would create the database and data in one shot, which is the difference between MySQL and Mongo.

Mark A
  • 1,995
  • 4
  • 18
  • 26