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

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!  
主站蜘蛛池模板: 麻栗坡县| 天柱县| 资源县| 凤阳县| 淳化县| 苏尼特右旗| 庆城县| 大厂| 辽阳县| 江都市| 临沂市| 浮梁县| 穆棱市| 万全县| 来安县| 天津市| 大港区| 永川市| 荥阳市| 杭锦旗| 嘉峪关市| 罗甸县| 鞍山市| 阿合奇县| 北碚区| 南和县| 济源市| 巴彦淖尔市| 洪雅县| 景宁| 桐庐县| 桐梓县| 封开县| 娱乐| 广东省| 图片| 望奎县| 罗定市| 梁平县| 青川县| 洛隆县|