MongoDB for Node.js developers – Course Experience

10Gen – MongoDB company offers free courses. In March 2013, I downloaded and configured MongoDB on my machine.  At that time, I knew 10Gen offers free courses of their product, but didn’t have a chance to get onto it. In August, I started MongoDB for Node.js developer course. The course was 7 weeks duration with estimated 5 hours per week commitment. This week was Final Exam week and I just completed my final exam. I have my own best practices and some regrets that I’d like to share.  For anybody who wants to understand the NoSQL and how it is different from traditional RDBMS, I highly recommend this course. Only thing is that you will need to know basics of Node.js. At least Javascript. There is a MongoDB for Java developer couse, but weekly commitment is double the Node.js course (10 hours per week).


Course material covers the main concept of MongoDB using Node.js driver and Mongo Shell. Someone without Node.js experience will likely having a hard time doing a homework, but most of home works are generally not too difficult to complete. Forum is pretty well maintained and staffs are pretty good at responding. Week 5, 6 focused on aggregation and shard, so not so much Node.js was discussed. I found the week 2 was the most difficult week. Not only so much knowledge, but also length of videos. Somebody in the forum wrote that he spent 15 hours to do the homework. I spent about 10 hours of watching videos and completed the homework. Sometimes, instructor explained the concept and ran his own Mongo shell really fast, so I had to rewind the video several times to understand the concept and do my own Mongo shell run side by side. Even though some homeworks uses Node.js and need to run code in Node.js, I felt more comfortable doing the same thing in the Mongo shell. Maybe because it gives me a result right away without starting Node.js. Also, lecture always uses Mongo shell to explain the concept.

Best Practice & Regrets

One thing I did well was taking a note from the video lecture and run my own command right after the concept is introduced. By doing this way, it took twice longer than just watching video lecture, but it paid back later during the final exam week. I just simply reviewed my notes and sample code from the note instead of searching for MongoDB manual.  I started to take a note from week 4. I didn’t think about this practice because of very well documented MongoDB manual. During the final exam, I felt I really need to refresh my memory in a short period of time and wish I had a note from earlier weeks.

Looking ahead

So now what? Course is over and I know how to use MongoDB including configuring replication environment. This opens up a perfect opportunity for me to experiment MongoDB with Hadoop. Next week or so, I will solidify my understanding of MongoDB and start to explore more options how Enterprise programming uses MongoDB in the real world. I will analyze real world situation when to use MongoDB and focus on why MongoDB is better in that situation.


NoSQL is a buzz word in a modern web development. MongoDB is one of the well known NoSQL DB and I believe it has its own place in the application development. With many years of RDBMS experience, using MongoDB requires a paradigm shift. No table relationship, no join. Just document itself represents the state of data. The syntax didn’t bother me so much because of JSON experience (I read an article complaining about MongoDB ruining JSON structure), but there are several things that requires strong mental notes :  Schema design, index strategy, and choosing a shard key in replication environment.

It was interesting 7 weeks with MongoDB and hope to identify my own unique usage of MongoDB in the real world project.


MongoDB getting started

Finally, I had a chance to install MongoDB. I made this page for my own reference. MongoDB offers free online course, so it will be a logical step to take this course after the installation and basic understanding. Installation seems very quick and easy. By looking at below basic command, I can see how powerful it can be when it is combined with other technologies.

  • Installation directory : C:\DevApps\mongodb\bin
  • Data : C:\DevApps\mongodb\data

Waiting for a connection

C:\DevApps\mongodb\bin>mongod.exe --dbpath c:\devapps\mongodb\data
Mon Mar 04 19:47:15 [initandlisten] MongoDB starting : pid=8100 port=27017 dbpath=
c:\devapps\mongodb\data 64-bit host=msjo-PC
Mon Mar 04 19:47:15 [initandlisten] db version v2.2.3, pdfile version 4.5
Mon Mar 04 19:47:15 [initandlisten] git version: f570771a5d8a3846eb7586xxxxxx4c2f4a96bf08
Mon Mar 04 19:47:15 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, 
build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Mon Mar 04 19:47:15 [initandlisten] options: { dbpath: "c:\devapps\mongodb\data" }
Mon Mar 04 19:47:15 [initandlisten] journal dir=c:/devapps/mongodb/data/journal
Mon Mar 04 19:47:15 [initandlisten] recover : no journal files present, no recovery needed
Mon Mar 04 19:47:15 [initandlisten] waiting for connections on port 27017
Mon Mar 04 19:47:15 [websvr] admin web console waiting for connections on port 28017
//After execute mongo.exe
Mon Mar 04 20:17:35 [initandlisten] connection accepted from #1 (
1 connection now open)
Mon Mar 04 20:18:38 [FileAllocator] allocating new datafile c:/devapps/mongodb/data/test.ns, filling with zeroes...
Mon Mar 04 20:18:38 [FileAllocator] creating directory c:/devapps/mongodb/data/_tmp
Mon Mar 04 20:18:39 [FileAllocator] done allocating datafile c:/devapps/mongodb/
data/test.ns, size: 16MB,  took 0.058 secs
Mon Mar 04 20:18:39 [FileAllocator] allocating new datafile c:/devapps/mongodb/data/test.0, 
filling with zeroes...
Mon Mar 04 20:18:39 [FileAllocator] done allocating datafile c:/devapps/mongodb/data/test.0, 
size: 64MB,  took 0.156 secs
Mon Mar 04 20:18:39 [FileAllocator] allocating new datafile c:/devapps/mongodb/data/test.1, 
filling with zeroes...
Mon Mar 04 20:18:39 [conn1] build index test.test { _id: 1 }
Mon Mar 04 20:18:39 [conn1] build index done.  scanned 0 total records. 0.075 secs
Mon Mar 04 20:18:39 [conn1] insert test.test keyUpdates:0 locks(micros) w:301949 301ms
Mon Mar 04 20:18:39 [FileAllocator] done allocating datafile c:/devapps/mongodb/data/test.1, 
size: 128MB,  took 0.313 secs

New command prompt

MongoDB shell version: 2.2.3
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
Questions? Try the support group
> {a:1})
> db.test.find()
{ "_id" : ObjectId("5135721e1652a3c0b2db4dcf"), "a" : 1 }
> show dbs
local   (empty)
test    0.203125GB
> use mydb
switched to db mydb
> db
> show dbs
local   (empty)
test    0.203125GB
> db
> j = { name: "mongo"}
{ "name" : "mongo" }
> k = {x:3}
{ "x" : 3 }
> db.things.insert(j)
> db.things.insert(k)
> show collections
> db.things.find()
{ "_id" : ObjectId("5135743d1652a3c0b2db4dd0"), "name" : "mongo" }
{ "_id" : ObjectId("513574441652a3c0b2db4dd1"), "x" : 3 }

It seems straight forward. Basically, it keeps the data key-value pair with internal unique ID. There are tons of example out there, so I will try to write a simple application to perform CRUD in my next posting.