Better understanding cleanupLocalData: false
I'm trying to better understand cleanupLocalData: false @raix maybe you can help explains this a bit. If cleanupLocalData is set to false my understanding that the local saved data is never cleaned up IE deleted and this is per browser / device. Is that correct?
If this is set to true or not set at all how is the local data removed / deleted and when? What triggers it? Also if your using iron-router and waitOn how is it deleted in that context?
Thanks, Almog
As far as I can see in the source, it always keeps the data in the browser. If a subscription gets [A, B, C] and then C is removed, you still have [A, B, C], but the Ground.Collection only shows you [A, B], since that's how it's supposed to work. If you, later on, get C from the subscription, it should be faster than re-downloading the data, since you already have it grounded.
If this is set to true or not set at all how is the local data removed / deleted and when? What triggers it? Also if your using iron-router and waitOn how is it deleted in that context?
If it is set to true, it is never deleted. If it is not set or set to false, GroundDB checks for changes in the pub/sub and deletes the data if it's not needed anymore.
Please note: I didn't test anything. I just did a quick lookup at the code.
normally grounddb will clear all localOnly documents on subscription ready - but this can be done manually also: https://github.com/GroundMeteor/db#additional-api
When we tested it out I ran into the following issue I have A, B, C data which syncs with the tablet, the tablet goes offline and later on a different user deletes C online. Again a day later the tablet that was offline goes online and resyncs now C which was deleted is back.
Should I set local data to false? Is this supposed to happen?
@almogdesign sounds like we might need to implement conflict resolution
Yes, I would keep it simple the database should always be right and they when making changes like edit or delete this should only be done in online mode and should be the developers responsibility , we're implemented that in our app.
@raix do you think you can do this in a quick update?
@almogdesign by turning of update/remove? - I've been thinking about having an option:
resume: {
insert: true,
update: false,
remove: false
}
Where pr. default all method resumes would be turned off - making grounddb a cache only layer pr. default.
gosh - I already implemented a resume = false option.
so if you only want inserts to resume you could:
Ground.methodResume([
'/' +collectionName + '/insert'
]);
Great so add the ground method resume
it will solve the issue of C being reinserted into the database.
How does it now it was deleted?
@raix is that correct?
via the subscription and the cleanupLocalData
Is there an example of this somewhere I want to make sure I get it right
What exactly is local only data?
data created on the client only or data removed on the server