Hello,
I am currently able to retrieve a number of Orders by use of following method and store it in a Grounded Collection:
public initGroundedCollectionOrders() {
if(Meteor.isClient) {
this.newOrders = new Ground.Collection('orders', {
cleanupLocalData:false
});
this.newOrders.observeSource(Orders.find());
Meteor.subscribe('orders', {
onReady() {
this.newOrders.keep(Orders.find({},{reactive: false}));
}
});
this.newOrders.once('loaded', ()=> {console.log('loaded'); });
}
}
I want to update the status of an order which is stored in “this.newOrders”. I do it by the following:
public updateGroundedOrder(orderid: number, status: string) {
var test = this.newOrders.findOne(orderid);
this.newOrders.update(test._id,
{ $set:
{ status: status }
});
}
This seems to update the order in the Grounded collection, but doesn’t sync it with the server. How can I make sure that when the specific order in the Grounded Collection ‘orders’ is updated, it in turn is synced and updated on the server side?