So lets say we have Project and Task entities in kinvey, each entity is stored in it's own collection (projects and tasks). When saving this entities I defined 'relations' so I can access the tasks related to a project easily.
// Save the Project, and save its Task as separate entity.
var promise = $kinvey.DataStore.save('project', project, {
relations : { task: 'tasks' }
});
That was easy and it's in the docs. But when deleting the task like this:
someService.deleteApplication = function(task){
return $kinvey.DataStore.destroy('tasks', task._id);
};
It does delete the item in tasks collection but an item in projects collection still holds a reference to the deleted task (In this case it says the project entity has 3 tasks (1 more than what it actually has) ).
how to overcome this ? is it in the docs?
Thanks!