Offline cordova with Ground:db

I need to have full offline capability for my cordova app. That means that I need all of my collections to be saved locally. I’ve installed ground:db like so (because v2 doesn’t allow for methodResume functions):

meteor add ground:db@0.3.5

And I’ve added the following lines of code to my app:

if( Meteor.isCordova ) {
  // This represents all of my collections
  Ground.Collection(Entries);
  Ground.Collection(Forms);
  Ground.Collection(Photos);
  Ground.Collection(Projects);
}
Ground.Collection(Meteor.users);
if( Meteor.isClient ) {
  Ground.methodResume([
    'createEntry',
    'updateEntry',
    'removeEntry',
    'createForm',
    'updateForm',
    'removeForm',
    'createPhoto',
    'updatePhoto',
    'removePhoto',
    'createProject',
    'updateProject',
    'removeProject',
    'updateUserDetails'
  ]);
}

My problem is that the cordova app does not save the entire collection (some documents are missing when I go to offline mode). Do I need to subscribe all of the documents in all collections in every route (in online and offline modes)?

GroundDB only persists what is in the client side cache already, so if you indeed need every record, then yes you will need to subscribe to all documents. Depending on the # of documents in a collection, this could get pretty heavy on the client to the point of possibly filling your LocalStorage to it’s limit.

I need offline support with my Meteor app, too. I’ve started to use persistent-minimongo2 package. So far I haven’t a big issue with it.

The 4.8MB storage limit of persistent-minimongo2 is too low for my needs.

Unfortunately, it is suitable only for text storage.
By the way, it is a big drawback for Meteor which is a platform for developing modern web and mobile applications, not to provide a real solution for offline data on the mobile.

How much info can I store in localStorage? I just Googled and it looks like 10MB is the limit in Android. Is this the limit for Ground:db?

As far as I know know groundDB’s limit is the limit of local storage

Is there a way around the 10MB limit?

Let’s say I want to store 1 megapixel photos (I realize I would have to save them as base64 strings). 10MB would fill up pretty quickly.

Perhaps Ground:DB is not the way to go. Are there other packages that are more suitable?

Localstorage is intended for key value pairs, as in a database. Why not store the images in device storage (disk) instead?

The limit is set and controlled by the browser. When working with the web platform you have to work within it’s constraints.

I don’t think this has much to do with Meteor and more to do with the constraints of the browser. You could always try react native and connect it to your meteor app.

you should definitely go for GroundDB II https://github.com/GroundMeteor/db/tree/grounddb-caching-2016

You will have to handle all the synchronization between your data on your back-end and your client, but for caching it locally I highly recommend this version of GDB.

I need to be able to resume method calls. Simply caching data isn’t really what I consider offline capability. I need is to be able to create new documents.