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

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!  
主站蜘蛛池模板: 翁牛特旗| 当雄县| 漯河市| 泰来县| 阿拉善盟| 土默特右旗| 定南县| 霍山县| 安阳县| 公安县| 大余县| 于田县| 阳春市| 垦利县| 怀来县| 康马县| 廉江市| 平塘县| 封丘县| 三亚市| 龙海市| 张掖市| 屯昌县| 隆林| 济阳县| 犍为县| 台东市| 屏南县| 叙永县| 通渭县| 和硕县| 肥乡县| 松潘县| 仪陇县| 绵竹市| 道孚县| 垫江县| 乐都县| 清涧县| 华亭县| 武宣县|