Cursor.observeChanges is slow


Publishing like this results in realtime distribution of data.

Meteor.publish("ItemsDirect", function () {
      return Items.find({});

Publishing like this will loose realtime in LiveQuery serverside:

Meteor.publish("ItemsObserve", function () {
      var handle = Items.find({}).observeChanges({
             added: function (id, fields) {
                 self.added("MyCollectionName", id, cleanObject(fields));
		// ...

It will take 1-10 s before the ‘added’-method is executed.
(Both Cursor.observe and Cursor.observeChanges has this behavior)

I’m doing like this because I need to set the collectionname (I need to hide my DB collection name for the client) and I need to clean my object before sending it to the client. BUT, I can not afford loosing realtime updates, it’s like running a MongoDB without oplog!

Can I remove this delay in Collection.observe?
Can I perhaps solve my problem in another way?

Tack you
Regards Magnus


I would suggest to learn Markdown or something similar before posting code.
So other people can see the formatting.

And you did not show us whole publish function, how you call this.ready() etc, which would be the main reason why it could be delayed etc…


Optionally you could be helpful and point out how to do it, instead of being snarky :wink:

Place three ` above and below the code to display a code block.