MongoDB for Node.js Developers – Week 1: MongoDB setup

Installing MongoDB

  • Course recommends installing the Download from MongoDB Download Center
    • Current Stable Release (3.2.10)
  • I installed using Homebrew which is already setup on my MAC
    • brew install mongodb
    • mongo –version
      MongoDB shell version: 3.2.10
    • mongod –version
      db version v3.2.10
      git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
      OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
      allocator: system
      modules: none
      build environment:
      distarch: x86_64
      target_arch: x86_64
    •  which mongo
      /usr/local/bin/mongo
    • which mongod
      /usr/local/bin/mongod
  • Make default data directory for MongoDB databases
    • sudo mkdir -p /data/db
    • sudo chmod 777 /data/db
  • Test setup
    • Start the server with mongod
    • Start the command line
      mongo
      MongoDB shell version: 3.2.10
      connecting to: test
    • > db.names.insert({‘name’:”Bill Moore”});
      WriteResult({ “nInserted” : 1 })
      > db.names.find()
      { “_id” : ObjectId(“57fd68463b07d5d5b5344d7b”), “name” : “Bill Moore” }
      >

Course notes for MongoDB for Node.js Developers

I recently enrolled in a course M101JS MongoDB for Node.js Developers at the MongoDB University and this series of posts will be my personal course notes. The main purpose of the posts is so that I have a record of my progress.
The programming education I do is in my own time and not directly related to my day job so if work gets busy I sometimes find it difficult to recall what I was last learning.

I have shared this publically in case fellow students find my notes useful.