建立临时的Collection用处

31 views
Skip to first unread message

魏永清

unread,
Sep 26, 2012, 1:52:29 AM9/26/12
to cn-met...@googlegroups.com
// Create a temporary, local collection. It works just any other
// collection, but it doesn't send changes to the server, and it
// can't receive any data from subscriptions.
Scratchpad = new Meteor.Collection;
for (var i = 0; i < 10; i++)
  Scratchpad.insert({number: i * 2});
assert(Scratchpad.find({number: {$lt: 9}}).count() === 5);
从文档中看到这个,实际应用中可以建立临时的不用关心同步的表,对数据的处理有统一的api的好处,考虑以后用,这样代码更规范。
Reply all
Reply to author
Forward
0 new messages