Skip to content

Commit

Permalink
mini-mongo cache clear on connect to remove stale documents (#275)
Browse files Browse the repository at this point in the history
* NetInfo change event changed to connectionChange event.

* Clearing cache of any stale collections after connection is established.
  • Loading branch information
ujwal-setlur authored and charpeni committed Oct 24, 2017
1 parent c4fbeb0 commit ac2d379
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ module.exports = {

Data.ddp.on("connected", ()=>{

// Clear the collections of any stale data in case this is a reconnect
if (Data.db && Data.db.collections) {
for (var collection in Data.db.collections) {
Data.db[collection].remove({});
}
}

Data.notify('change');

console.info("Connected to DDP server.");
Expand Down

0 comments on commit ac2d379

Please sign in to comment.