官术网_书友最值得收藏!

Launching the sample app

Once you have the complete code saved to app.js, it's time to execute it and see what happens. However, before you can launch an app that clearly relies on a connection to MongoDB, you need to first boot up the MongoDB daemon instance:

    $ mongod
In Windows, if you haven't set a PATH variable for mongod, you may need to use the full path while executing MongoDB, which is c:\MongoDB\bin\mongod.exe. For your needs, the remainder of this book will refer to the mongod command, but you may always need to execute the full path in each instance.

Now, to launch the app itself, execute the following command after moving to the root folder where app.js is located:

    $ node app.js

When the app first executes, you should see the following:

    Connected correctly to server
    Success :2 chapters inserted!  
主站蜘蛛池模板: 浏阳市| 玉林市| 宜都市| 富民县| 威远县| 崇义县| 闻喜县| 桑日县| 青冈县| 谷城县| 水富县| 通化县| 夹江县| 庄浪县| 扎赉特旗| 乐昌市| 北京市| 罗源县| 泌阳县| 道孚县| 山阴县| 瓦房店市| 琼海市| 邢台县| 晋州市| 固阳县| 巨鹿县| 景泰县| 连江县| 都匀市| 甘谷县| 织金县| 南岸区| 浦城县| 黄浦区| 汽车| 洛扎县| 浙江省| 观塘区| 富顺县| 永泰县|