javascript - Meteor publication Exception: Did not check() all arguments during publisher when using aldeed:tabular -


i have following publication:

meteor.publish( 'usersadmin', function() {   return meteor.users.find( {}, { fields: { "emails": 1, "roles": 1, "profile": 1 } } ) }); 

and i'm displaying publication in following table using aldeed:tabular:

tabulartables.usersadmin = new tabular.table({       name: "user list",       collection: meteor.users,       pub: "usersadmin",       allow: function(userid) {         return roles.userisinrole(userid, 'admin');       },       columns: [{         data: "emails",         title: "email",         render: function(val, type, doc) {           return val[0].address;         }       }, {         data: "roles",         title: "roles",         render: function(val, type, doc) {           return val[0]._id;         }       }]); 

the table displays fine, in server terminal following exception shows up:

 exception sub usersadmin id 2d7nfjgrxfbz2s44r error: did not check() arguments during publisher 'usersadmin' 

what causes this?

you receive error because need check arguments passed usersadmin publish function using check(value, pattern).

the reactive datatables, implemented in aldeed:tabular package, pass arguments tablename, ids , fields publish function; that's why exception thrown.

according documentation, need take care of following requirements:

your function:

  • must accept , check 3 arguments: tablename, ids, , fields
  • must publish documents _id in ids array.
  • must necessary security checks
  • should publish fields listed in fields object, if 1 provided.
  • may publish other data necessary table

this should fix error:

meteor.publish('usersadmin', function(tablename, ids, fields) {   check(tablename, string);   check(ids, array);   check(fields, match.optional(object));   return meteor.users.find({}, {fields: {"emails": 1, "roles": 1, "profile": 1}}); }); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -