1

Would it be possible to make all my subscriptions non-reactive?

This means, that once the inicial set has been sent to the client, server stops observing the cursors.

I found the following answer here: Are non-reactive Meteor db subscriptions possible?

This works, but I'd prefer a "global" solution.

Ideally, I'd like to have the option to choose which subscriptions would be reactive and which won't. For example, I'd like to have all logged in "admin" users to have reactive data, however, regular website visitors don't need this.

Thanks! :)

Community
  • 1
  • 1
Radko
  • 101
  • 6
  • There's another answer here: http://stackoverflow.com/questions/19656019/how-to-disable-reactivity-temporarily-and-just-update-retrieve-local-mongodb, which may be what you want. There is a specific option {reactive: false}. – mwarren May 27 '15 at 21:00
  • You can also fetch all the data, it won't be reactive – sdooo May 27 '15 at 21:07
  • this doesn't answer the question. The point is not about reactivity in the page, but about synching the data; so the `reactive: false` is only part of the answer. I think the best option is still described in the link in the question; I'd just write a little wrapper function for this to do it on all data; – Christian Fritz May 27 '15 at 21:09
  • possible duplicate of [Is there a way to tell meteor a collection is static (will never change)?](http://stackoverflow.com/questions/17699022/is-there-a-way-to-tell-meteor-a-collection-is-static-will-never-change) – Christian Fritz May 30 '15 at 01:26

1 Answers1

0

You can by simply adding {reactive: false} on your publication options.

// This code only runs on the server
Meteor.publish("company", function companyPublication(){
  if (this.userId) {
    return Company.find({userId: this.userId},{limit:1, reactive: 
 false});
  } else {
    return this.ready();
  }
});