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

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.

主站蜘蛛池模板: 乐业县| 乌拉特后旗| 永平县| 达尔| 靖西县| 康保县| 盐亭县| 老河口市| 镇雄县| 新建县| 高安市| 东海县| 马边| 建始县| 华亭县| 临朐县| 贡嘎县| 西乌珠穆沁旗| 泾阳县| 巨鹿县| 乌审旗| 珲春市| 松阳县| 宁城县| 金湖县| 天祝| 康平县| 天镇县| 巴南区| 黄平县| 怀远县| 民和| 宜川县| 永昌县| 元阳县| 灌阳县| 来安县| 龙江县| 三都| 麻栗坡县| 济阳县|