reactive-table icon indicating copy to clipboard operation
reactive-table copied to clipboard

ReactiveTable.publish: no collection to publish

Open abate opened this issue 9 years ago • 1 comments

Consider the following snippet. What I'm trying to do is to publish data for a reactive table and I need to add one field to the Meteor.users collection (I want to use a custom filter and I can't use a virtual field client side). The function applicationStatus needs to access a few other collections...

ReactiveTable.publish "resources-data", () ->
  if Roles.userIsInRole(this.userId, [ 'manager' ])
    query = {roles: {$not: {$elemMatch : {_id: 'manager'}}}}
    Meteor.users.find(query).map (user) -> _.extend(user,{status: applicationStatus(user)})

The problem is that map returns an Array and not a collection.

I've the feeling this is entirely possible, but I'm just stuck here. Any advices ?

abate avatar Sep 28 '16 16:09 abate

Sorry, but I don't think it's possible with ReactiveTable.publish. It's only set up to work with a single collection and a selector. You'll need to write your own publication for anything more complicated.

aslagle avatar Oct 01 '16 18:10 aslagle