How to use persistent-minimongo with react-meteor-data?


#1

Does anyone know how to use persistent-minimongo2 within the withTracker function of react-meteor-data?


#2

Basically persistent-minimongo2 just copies data from local storage or indexdb into your client side collection and then starts an observer to keep the local storage/indexdb up to date with the collection. The way you integrate reac-meteor-data shouldn’t change at all.


#3

Although the off-line data feature is working fine, I am having insert failed: WriteError({"code":11000,"index":0,"errmsg":"E11000 duplicate key error. I use the package as follows in mycollection.js;

export const MyCollection = new Mongo.Collection('mycollection');
if (Meteor.isClient) {
    console.log('Setting Mini Mongo Observer');
    const persistentColl = new PersistentMinimongo2(MyCollection, 'testapp');
}

Apparently, meteor-persistent-minimongo2 tries to insert an existing document. But the source code making the ìnsert` operation seems correct. What do I miss here?