In a situation where one needs to insert a very large amount of documents into a minimongo collection, but whose collection already has a few queries depending on it (cursors bound to Template helpers for example), how does one efficiently approach this situation without locking up the interface?
Asked
Active
Viewed 229 times
1 Answers
2
Insert directly against _collection.docs
, and then iterate over _collection.queries
and invalidate via LocalCollection._recomputeResults()
.
Example:
_.each(bulk, function (doc) {
MyCollection._collection.docs[doc._id] = doc;
});
_.each(MyCollection._collection.queries, function (query) {
LocalCollection._recomputeResults(query);
});

matb33
- 2,820
- 1
- 19
- 28