ground-db
ground-db copied to clipboard
Updating Collection does not effect view while offline
So I have groundDB running so that my app will work offline. It is set up like the following:
Orders = new Mongo.Collection("orders");
Ground.Collection(Orders);
And that collection contains the following Schema (simplified for explanation):
Orders.attachSchema(new SimpleSchema({
completed: {
type: Boolean,
defaultValue: false
}
}));
My app shows only documents that are marked {complete:false}:
Template.currentOrder.helpers({
currentO: function(){
return Orders.find({completed: false});
}})
and there is a button to mark documents as {complete:true} via a method which is also cached:
if ( Meteor.isServer ) {
Meteor.methods({
updateAll: function(){
Orders.update({},{$set:{'completed':true}},{multi:true});
},
});
}
if ( Meteor.isClient ) {
Meteor.startup(function() {
if ( Meteor.isClient ) {
Ground.methodResume([
'/' + self.name + '/insert',
'/' + self.name + '/remove',
'/' + self.name + '/update',
'updateAll'
]);
}
});
}
The problem is that when a document is updated to be {complete:true}, it is still displayed by the app. Im not sure how to get the app to respond to the changes in the instance of GroundedDB. As a side note, as soon as the connection is resumed the Collection is updated and the documents now marked as {complete:true} disappear as expected.
Any help would be greatly appreciated :)
I've released 2.0.0-alpha.1
Notes about the new version, migration and what it doesn't do - The issue might be resolved in that version, let me know what you think
@SinAndTonic I was looking for you regarding another topic. Please check my commit for details.
Sorry for inflating here.