elbowz
elbowz

Reputation: 567

observe(callbacks), know when CRUD event comes form client (local) o server (remote)

if apply observer to a Collection, I don't want repeat two times the same thing on local.

Example on a diagram CRUD operation (a diagram is made of elements)

Local

  1. Add/remove/edit a element (gui)
  2. Intercept event and make Add/remove/edit on Collection (each element is a document)
  3. Obeserver catch event on Collection WRONG!

Remote

  1. Observer catch event on Collection
  2. Add/remove/edit a element (gui)

Upvotes: 0

Views: 59

Answers (1)

elbowz
elbowz

Reputation: 567

I have find a solution (workaround).

I have add an user field to document. This store the user that make the CRUD event.

In the observer I check document.user

if(document.user != Meteor.userId()) // remote CRUD

Upvotes: 1

Related Questions