Observe collection changes made only by other clients


#1

Hi,
Is there a way to get notified when collection is changed by other client? I don’t want to catch the event made by the current client.

The closest thing I can find is to use collection.observeChanges(), but the bigger problem is that

  1. the “added” is triggered for every doc when the query first run, I basicly
    need to observe the changes after the local collection has been
    initialized.

  2. I only want to identify the external changes(add/modify/remove), I don’t even want to know the detail delta, only let me know “the current query is outdated by other clients”.

    observeHandle = Collenction.find().observeChanges({
    // only want to monitor the added event from external source
    added: function (id, fields) {
    console.log(“observeChanges added”);
    }
    });

What should I do to solve this problem?

Thank you!


#2

I have the same requirement. Keen to hear how people are solving this.

My req: I have notification documents, which i want to animate temporarily on receipt by the client.


#3

You could persist the connection id on the document and filter by that. If you don’t want them clogging up your db, you could do clean ups afterwards.


#4

And regarding your point 1, use a simple initializing flag to filter out the initial data load (see last code sample of this section).