[Solution] Week 1 : Introduction : M101JS: MongoDB for Node.js Developers

[Solution] Week 1 : Introduction : M101JS: MongoDB for Node.js Developers


Homework 1.1 : 

Install MongoDB on your computer and run it on the standard port.

Download the hw1-1.zip from Download Handout link and uncompress the file.

Change directory into hw1

Use mongorestore to restore the dump into your running mongod. Do this by opening a terminal window (mac) or cmd window (windows) and navigating to the directory so that the dump directory is directly beneath you. Now type:

mongorestore dump

Note you will need to have your path setup correctly to find mongorestore.

Now, using the Mongo shell, perform a find() on the collection called hw1_1 in the database m101. There is one document in this collection. Please provide the value corresponding to the "answer" key (without the surrounding quotes) from the document returned.

Answer :  Hello from MongoDB!










Homework 1.2 : 

Your assignment for this part of the homework is to install the mongodb driver for Node.js and run the test application.To do this, first download the hw1-2.zip from Download Handout link, uncompress and change into the hw1-2 directory:

cd hw1-2

Use mongorestore to restore the dump into your running mongod. Do this by opening a terminal window (mac) or cmd window (windows) and navigating to the directory so that the dump directory is directly beneath you. Now type:

mongorestore dump

Note you will need to have your path setup correctly to find mongorestore.

Then install the dependencies.

npm install

This should create a "node_modules" directory. Now run the application to get the answer to hw1-2:

node app.js

If you have the mongodb driver installed correctly, this will print out the message 'Answer: ' followed by some additional text. Enter that additional text in the box below.



Answer : I like kittens
















Homework 1.3 : 



Your assignment for this part of the homework is to install the mongodb driver for Node.js, Express, and other required dependencies and run the test application. This homework is meant to give you practice using the "package.json" file, which will include some of the code that we provide.



To do this, first download the hw1-3.zip from Download Handout link, uncompress and change into the hw1-3 directory:



cd hw1-3



Use mongorestore to restore the dump into your running mongod. Do this by opening a terminal window (mac) or cmd window (windows) and navigating to the directory so that the dump directory is directly beneath you. Now type:



mongorestore dump

Note you will need to have your path setup correctly to find mongorestore.

Then install all the dependencies listed in the 'package.json' file. Calling 'npm install' with no specific package tells npm to look for 'package.json':

npm install

This should create a "node_modules" directory with all the dependencies. Now run the application to get the answer to hw1-3:

node app.js

If you have all the dependencies installed correctly, this will print the message 'Express server listening on port 3000'. Navigate to 'localhost:3000' in a browser and enter the text that is displayed on that page in the text box below.

Answer : Hello, Agent 007.



















Note : If you use Answer from this please take that with its sign(. or !) because that will included into your answer.


Enjoy....!!!!

Feel free to comment below your experience with above approach and If you still find any problem  with above steps Let me know I would love to help you to resolve your  problem.

 If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to  Visionfortech


Related Post : 


Comments

  1. Hi.. I didn't get download links hw1-1, hw 1-2, hw 1-3.
    please help me..

    ReplyDelete
    Replies
    1. What kind of link you want..!!
      I have provided the answer above and that's all right answer because i have implemented that.

      Let me know what else i can help you out ?

      Delete
  2. This comment has been removed by the author.

    ReplyDelete

Post a Comment