Reputation: 1144
Is there any way that i can call a function when any update, delete or create function executed in database. I have a Boolean variable which is true by default. When someone create update or delete an element from the database i want to set that boolean variable to false. e.g my code is
<template name="questions">
{{#each question}}
<tr>
<td>{{name}}</td>
<td><<input type="button">Delete</button></td>
<td><input type="button"Update</button></td>
</tr>
{{/each}}
</template>
I want if a Delete or Update action is successfully performed on these questions elements the boolean variable become false.
Upvotes: 0
Views: 74
Reputation: 2820
I wrote a smart package to handle the part of firing a callback on insert/update/remove: https://github.com/matb33/meteor-collection-hooks
In this callback you could then change your Boolean value either by running an update or mutating the document/query.
Upvotes: 2