-1

我搜索同步我的 Backbone.Collection 和 Meteor MongoDB 集合的最佳方式。最好的方法是什么?我想通过客户端发出 POST/GET 请求。

4

1 回答 1

0

Meteor already keeps your server collections and client-side cached collections in sync. If you wish to use backbone.js collections, you can do it in two ways.

First way: use an observe on MongoDB cursor, look for all 'added', 'changed' and 'removed' events and deal with them however you want. More in docs.

Second way: to keep memory consumption lower and not keep two copies of every object in both Minimongo and Backbone collections, you can go one level lower and use registerStore - client-side DDP API.

For API docs look at the source code. Also DDP specs can help, look at "Managing Data" section.

于 2013-07-21T03:27:24.237 回答