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

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!  
主站蜘蛛池模板: 镇沅| 桃园市| 龙泉市| 绥德县| 额敏县| 彝良县| 调兵山市| 延寿县| 大化| 清新县| 井陉县| 班戈县| 滁州市| 梁河县| 正蓝旗| 元阳县| 普兰店市| 湘乡市| 新疆| 平远县| 甘泉县| 繁峙县| 湘潭县| 汕头市| 澎湖县| 西和县| 镇原县| 祥云县| 岑溪市| 苍南县| 卢氏县| 日照市| 华宁县| 黔西县| 墨玉县| 织金县| 锦州市| 忻州市| 元谋县| 伊川县| 福安市|