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

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!  
主站蜘蛛池模板: 胶南市| 朝阳市| 衡水市| 合川市| 开封市| 柏乡县| 金寨县| 黑龙江省| 辛集市| 罗江县| 时尚| 东平县| 丹寨县| 额济纳旗| 舟曲县| 海原县| 济源市| 巴南区| 洛南县| 沁源县| 雷州市| 无棣县| 洮南市| 平阴县| 都兰县| 宜都市| 铁力市| 方山县| 高阳县| 昌邑市| 玉林市| 威信县| 老河口市| 佛学| 阆中市| 苍梧县| 锡林浩特市| 秀山| 建水县| 水城县| 东乌珠穆沁旗|