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” }
      >

Leave a Reply

Your email address will not be published. Required fields are marked *