javascript - Meteor publishing field issue -
my application publishing 'memberprice' field when not supposed to. in publish.js file, specified memberprice not published. here server/publish.js:
meteor.publish('cars', function() { return products.find({category: 'vehicle'}, {limit: 10}, {fields: {memberprice: 0}}); });
my controller:
carscontroller = routecontroller.extend({ waiton: function () { var sessionid = session.get('sessionid'); console.log("session: ", sessionid); meteor.subscribe('cars'); meteor.subscribe('cartitems', sessionid); }, action: function() { this.render('cars'); } });
here's table using aldeed:tabular package:
tabulartables = {}; meteor.isclient && template.registerhelper('tabulartables', tabulartables); tabulartables.cars = new tabular.table({ name: "cars", collection: products, columns: [ {data: "productcode", title: "product code"}, {data: "brand", title: "brand"}, {data: "productlinename", title: "product name"}, {data: "description", title: "description"}, {data: "memberprice", title: "member price"} ] });
does know what's going on?
thanks!
in past publish 1 have, since read post david weldon page.
i change publish this.
meteor.publish('cars', function() { var selector = {category: 'vehicle'}; var options = {limit: 10,fields: {memberprice: false}}; return products.find(selector,options); });
based on publish function have, memberprice option should exclude here, try this, here following correct syntaxis of collection.find wich collection.find([selector], [options])
, have collection.find([selector],[selector],[options])
.
Comments
Post a Comment