jeffmitchel / meteor-local-persist

Persistent client (browser) collections for Meteor, using localStorage.
Other
33 stars 11 forks source link

Not working when we remove the application from device's memory. #4

Closed niketaB closed 8 years ago

niketaB commented 8 years ago

Hi, I have tried with this package with one of my Ionic-meteor application to get data persistence on device. It gets data from server using Meteor DDP when device has network connection.

users = new Mongo.Collection('user');

this stores data into IndexedDB. myPersistDiscussions = new PersistentMinimongo2(users, 'MyApp');

I have added one observer to keep data synced. var myPersistDiscussionsObserver = new PersistentMinimongo2(users, 'MyApp'); Now I am able to get data from meteor collection named "users".

 $scope.listData = $meteor.collection(function() {
      return users.find();
 });

Issue : It gets data from server using Meteor DDP when device has network connection. It gets data from device's meteor collection (Cached data) when device has no network connection but application is in memory. It is not getting data from persistent database when you removed the application from memory and internet connection is not available on device.

Please let me know if anybody has tried this thing or done successfully before.

jeffmitchel commented 8 years ago

Hi,

It looks like you are using Fabian Vogelstellar's PersistentMinimong2 package. Fabian's package is a fork of this package.

I can tell you that your use case is not support by this package, as it is intended for browser only collections. I am reasonably certain that this is also the case for the Fabian's fork.

I can imagine ways that the data could be copied into a local collection while connected and then interrogated while offline. Though if you wished to modify the data, you would quickly run into all of the problems inherent in any offline synchronization system.

Jeff

jeffmitchel commented 8 years ago

See also this issue:

https://github.com/jeffmitchel/meteor-local-persist/issues/2

I will update the README to explicitly state that this use case is not supported.