简体   繁体   中英

Is there a way to limit published fields in Meteor aldeed tabular package

is there a way to limit what data is published to an aldeed tabular datatable? For example, if my collection has attributes A, B, C, D, attribute C is very sensitive and therefore I want to prevent it from being published, so only attributes A, B, D are published to the datatable. I checked the documentation but could not find an explicit answer to this...

Thank you!!

You should remove the autopublish package .

and you should limit field to return from a query , in this case on the publish function.

Meteor.publish('dataTable',function(){
  return Data.find({}, { fields: { A: true, B: true, C: false, D: true } });
}

And simply Subscribe to that publish

Meteor.subscribe('dataTable')

NOTE: if you have the collection on the /lib folder, be sure to make the Subscribe reactive with

Tracker.autorun(function(){
 Meteor.subscribe('dataTable')
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM