Meteor trigger event when server collection changes

I would like to trigger an event on a meteorite server when a document in my collection changes to a specific value, say some field changes from false to true.

I am familiar with client-bound events; however, I only want this event to be triggered when the server state changes, specifically the value of the given document in my collection. I want to make an external HTTP call from the server when this happens as I need to send external applications.

+3


source to share


2 answers


It looks like this is an old post. In the interests of others.



The Peerdb package seems to do some of the tasks you are looking for. https://atmospherejs.com/peerlibrary/peerdb

0


source


Also, a little late, but the most classic solution to this problem is to use a very popular library meteor-collection-hooks . In particular, you probably want to use . After.update (click the link for full documentation), which allows you to connect to a specific collection after the update is done in the document and compare before and after, comparing doc

(doc after update) to this.previous

(doc before update).



0


source







All Articles