reactive-table
reactive-table copied to clipboard
ReactiveTable.publish: no collection to publish
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 ?
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.