your syntax is off, it should be
CollectionName.find({}, {fields: {'onlyThisField':1}});
or
CollectionName.find({}, {fields: {'everythingButThisField':0}});
your template really controls what data is displayed, but there are still many scenarios where the field restriction makes sense - data privacy or efficiency (some fields of all records, all fields of the "current" record) are two common
you did not mention this, but it is usually in the publish function - see http://docs.meteor.com/#meteor_publish - the fields modifier is also available on the client, but there it does not limit the data sent to the client, just to reduce / Selecting a server-side field has different advantages.
-
double check that you also uninstalled the autopublish package, however you should see a warning if you have this asset and write your own publishing functions, in which you most often use fields
nate-strauser Apr 12 '13 at 1:20 2013-04-12 01:20
source share