Store Data in MongoDB


  1. We'll build this Waypoint on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.
  2. If you don't already have Cloud 9 account, create one now at http://c9.io.
  3. Open up http://c9.io and sign in to your account.
  4. Click on the "+" icon at the top right of the c9.io page to create a new workspace.
  5. Give your workspace a name and an optional description.
  6. Choose Node.js in the selection area below the name field.
  7. Click the "Create workspace" button.
  8. Once C9 builds and loads your workspace, you should see a terminal window in the lower right hand corner. In this window use the following commands. You don't need to know what these mean at this point.
  9. Install learnyoumongo with this command: npm install learnyoumongo -g
  10. Install MongoDB with this command: sudo apt-get install mongodb-org
  11. Set up your mongod alias by following the directions at https://community.c9.io/t/setting-up-mongodb/1717.
  12. Now start the tutorial by running learnyoumongo.
  13. Whenever you run a command that includes mongod on c9.io, use ./mongod instead. Together with the commands used in Step 11, this adds additional parameters to the mongod command to allow MongoDB to run in the C9 environment.
  14. Note that you can resize the c9.io's windows by dragging their borders.
  15. Make sure that you are always in your project's "workspace" directory. You can always navigate back to this directory by running this command: cd ~/workspace.
  16. You can view this Node School module's source code on GitHub at https://github.com/evanlucas/learnyoumongo.
  17. Complete "Mongod"
  18. Complete "Connect"

    Note: Use the command mongod --port 27017 in place of mongod --port 27017 --dbpath=./data to avoid a duplicate parameter error.

    --dbpath=./data is already included in the ./mongod command.
  19. Complete "Find"
  20. Complete "Find Project"
  21. Complete "Insert"
  22. Complete "Update"
  23. Complete "Remove"
  24. Complete "Count"
  25. Complete "Aggregate"
  26. Once you've completed these steps, move on to our next challenge.
I've completed this challenge (ctrl + enter)
Get help
Report a bug