Skip to content

Instantly share code, notes, and snippets.

@wahyudibo
Last active November 14, 2016 08:01
Show Gist options
  • Save wahyudibo/ff40d959017f8e92dad5a163d8135ceb to your computer and use it in GitHub Desktop.
Save wahyudibo/ff40d959017f8e92dad5a163d8135ceb to your computer and use it in GitHub Desktop.
I use this when following tutorial in https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4 to create mongo database on my project folder.
  1. cd /path/to/your/project
  2. mkdir data
  3. mongod --dbpath /path/to/your/project
  4. A bunch of text should appear, you will see "I NETWORK [initandlisten]" alot;
  5. type "mongo" and press enter
  6. MongoDB shell version: your-mongo-version connecting to: test should be appear in your console. If not, repeat from step 1
  7. Still in mongo console, type "use your-db-name"
  8. You should see "switched to db your-db-name"
  9. Now you can put 'mongodb://localhost/node_api' in your connection settings

credits : original procedure can be seen at https://disqus.com/by/JosephBeuysMum/ comments on https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4 to create mongo database on my project folder. I just do some little adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment