流星中有什么方法可以在服务器端对已发布的集合进行批量更改?...比如更新/插入数百或数千条记录,而无需将每条记录一一发送给所有订阅者?
我定期拉入第三方数据,只想将所有更新或插入一次拉取为一批更新,以便所有客户将其作为一个更改包接收,而不是数千个迷你更新。一个一个地做会在我的应用 atm 中造成很大的瓶颈。
如果流星不支持此 atm,那么我是否应该直接对 mongo 进行更新并让流星在下一次 mongo 民意调查中获取它?
// imagine myChanges array with 1000 items
myChanges.forEach(function(change){
// this will trigger the sync with clients immediately... 1000 times
// currently this will practically hang my server
// i want to gather the changes here instead
MyCollection.update({_id: change.docId}, change);
});
// and trigger the sync here instead
谢谢,雷欧