Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Collection does not effect view while offline #146

Closed
SinAndTonic opened this issue Jan 15, 2016 · 2 comments
Closed

Updating Collection does not effect view while offline #146

SinAndTonic opened this issue Jan 15, 2016 · 2 comments

Comments

@SinAndTonic
Copy link

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 :)

@raix
Copy link

raix commented Apr 6, 2016

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

@hellkaim
Copy link

@SinAndTonic I was looking for you regarding another topic. Please check my commit for details.

Sorry for inflating here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants