Helper for re-running subscription similar to Apollo's resetStore();?

I have a publication that is being queried using another publication similar to:

let usersNotToShow = UsersNotToShow.find().fetch();
let idsNotToShow = usersNotToShow.map(item => item._id);
return Meteor.users.find({_id: { $nin: idsNotToShow } })

The UI shows a list of users. I can add a user to the do not show list (ie. add them to the UsersNotToShow collection), but this won’t re-run the publication which is only looking at the Meteor.users collection. With Apollo I could use resetStore(), but how to do something similar in meteor?

I’m using react-komposer to pub/sub.

Hey did you ever figure this out? I found this from Google and have the same issues.

Its like running a logic query on a publication breaks reactivity?!

I think I ended up adding a count to the user’s collection that I increment when adding to the other collection. In my case, I had something like a UsersCollection and LikesCollection. When somebody did a like, I would increment a property on the users collection called numberOfLikes… but I can’t 100% remember. There is not helper function though.

1 Like

Yeah gonna have to do some buggery. Meteor is too good

In a regular old publication you can do a lot of find's and fetch'es but the only cursor that is being observed is the one you return. There are a couple of options that spring to mind.
a) return both cursors (publish can return an array of cursors)
b) use the low level API to observe the UsersNotToShow collection and in the e.g. added callback, fetch the user and return it.
Hope that helps