Is it true that Tracker is client-side only?

I just suggested using Tracker as a solution to a fellow forum member’s problem (Async function server method using YQL npm module)

He replied that my suggestion is not valid since Tracker does not work on the server, which surprised the hell outta me.

Is he right?

1 Like

It’s true, Tracker is meant for client-side only. There are alternative approaches though, probably you’ll want to react to data changes, for which you can use cursor.observeChanges().

Other options are collection hooks:

And server-autorun if you really need the autorun capability:

1 Like

Really good to know. Thank you.

Now that I return to the documentation I see “Client” specified in the title bar of every method – (too big to see ¡duh! )

@mitar created a server-side version of Tracker though (for autoruns). You can give that a try:

And technically, Tracker is usable in the server, it’s just that your autoruns need to be inside Meteor.bindEnvironment() (if you do things requiring to be Fiber-wrapped, like MongoDB operations).

Tracker.autorun(Meteor.bindEnvironment(function () {
   // Do reactive stuff...

Here’s an example: