Meteor-Community-Packages / Meteor-Community-Packages/ground-db
Updating Grounded Collection + syncing with server
- Dominant language
- JavaScript
- Stars
- 569
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
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) {
console.log('METEOR IS CLIENT');
this.newOrders = new Ground.Collection('orders', {
cleanupLocalData:false
});
this.newOrders.observeSource(Orders.find());
Meteor.subscribe('orders', {
onReady() {
this.newOrders.keep(Orders.find({},{reactive: true}));
}
});
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) {
this.newOrders.update({ _id: orderid },
{ $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?
Contributor guide
Research direction
Start with the initGroundedCollectionOrders and updateGroundedOrder methods shown in the issue, then trace how Grounded Collection updates are propagated to the server. Confirm the supported synchronization path and verify that changing an order's status in the local collection results in the corresponding server-side update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100