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

Explore MongoDB in the Meteor shell

You can access all the application data with the Meteor MongoDB shell.

Open another terminal, cd to the app directory, and start the MongoDB shell.

The app should be running at the same time.
>> meteor mongo

Show all the databases in MongoDB:

>> show dbs

The default database for the app is named meteor; switch to the meteor database:

>> use meteor

Display all collections in the database:

>>show collections

The show collections command will not return any results.

The reason is that we created a collection on the client side only. This collection exists in Minimongo, and it is in the browser's memory. If we refresh the page, the collection and the data will be gone.

In order to create the same collection and persist data into MongoDB, we have to execute the exact same Time = new Mongo.Collection('time'); on the server. As soon as we do that, both the collections will be in sync and the data will be persisted into the database.

For now, we don't want to save the timer data on the server; we only want to take advantage of the Meteor server to client real-time communication.

主站蜘蛛池模板: 堆龙德庆县| 大邑县| 古丈县| 临澧县| 茌平县| 涿鹿县| 天等县| 扶余县| 九寨沟县| 北海市| 永泰县| 商南县| 西昌市| 溧水县| 当雄县| 察雅县| 钟祥市| 赫章县| 会泽县| 镶黄旗| 邹城市| 大渡口区| 桐乡市| 鹤壁市| 宜州市| 清新县| 巨野县| 如皋市| 苗栗县| 西盟| 邵阳市| 黑山县| 环江| 锦屏县| 郓城县| 高尔夫| 江川县| 温州市| 策勒县| 耒阳市| 三河市|