problems with meteor ground:db while persisting data between app restarts

196 views Asked by At

I am using meteor package ground db "https://github.com/GroundMeteor/db"

in my meteor & ionic app. I am facing a problem in data persistence between app restarts. Initially when the app starts and then goes into offline mode during navigating the app, the data is retained. However if I close and restart the app in offline mode, the data is lost. How can I get the data grounded previously during app start, later on when the app is restarted while offline?

My ground db version is 2.0.0-rc.7 and ionic version is 3.1.1

My code is :

In collections.ts (common to both client and server)

export const Messages = new MongoObservable.Collection("messages");

in client (at app start)

this.persistentColleciton = new Ground.Collection('msgs', Messages);

client

if(Meteor.status().connected){
    MeteorObservable.subscribe('messages').subscribe(() => {
    this.autorunMsg();
    });
} else {
    this.messages = Messages.collection.find().fetch();
}
0

There are 0 answers