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

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.

主站蜘蛛池模板: 紫云| 正阳县| 邳州市| 云安县| 长治市| 广水市| 大宁县| 上蔡县| 武定县| 太仆寺旗| 巨野县| 白河县| 洛浦县| 图木舒克市| 阿拉善盟| 武山县| 晋江市| 江津市| 青龙| 巴东县| 漳平市| 巴彦县| 蓬莱市| 通道| 卓尼县| 新闻| 侯马市| 凉城县| 洱源县| 汉源县| 无为县| 绍兴市| 连江县| 辽阳市| 阳江市| 辽阳市| 新巴尔虎右旗| 阜阳市| 贵溪市| 方城县| 惠来县|