将角色名称发布到 table Meteor alanning:roles 和 aldeed:tabular

Publishing role names into a table Meteor alanning:roles and aldeed:tabular

我无法在 table 中显示创建的角色。我正在使用 alanning:roles 和 aldeed:tabular。要创建 table 我有:

TabularTables.RolesAdmin = new Tabular.Table({
   name: "Roles",
   collection: Meteor.roles,
   pub:"rolesadmin",
   allow: function (userId) {
     return Roles.userIsInRole(userId, 'admin');
   },
   columns: [
     { 
       data: "name",
       title: "Role Name",
     },
   ],
});

出版物看起来像这样:

Meteor.publish( 'rolesadmin', function() {
  return Meteor.roles.find( {}, { fields: { "name": 1 } } );
});

当运行应用程序table只显示"Processing..."因此出现错误并且无法在access/find数据?

我在服务器终端中收到以下异常:

Exception from sub rolesadmin id 6c6x3mDzweP8MbB9A 
Error: Did not check() all arguments during publisher 'rolesadmin'

如果我签入 mongo db.roles.find(),则没有 id 为 6c6x3mDzweP8MbB9A 的角色。这个错误指的是什么?

来自meteor-tabular docs

To tell Tabular to use your custom publish function, pass the publication name as the pub option. Your function:

MUST accept and check three arguments: tableName, ids, and fields

MUST publish all the documents where _id is in the ids array.

MUST do any necessary security checks

SHOULD publish only the fields listed in the fields object, if one is > provided.

MAY also publish other data necessary for your table

看来您需要适当地考虑文档中提到的这三个参数。不过,根据您发布的内容,我不确定您是否真的需要自定义发布。