Substring a field inside a publish function


How to achieve this? I have this code:

var user = Meteor.users.find({_id: id}, {fields: {'settings': 1}});

and then I want something like this:

if (user.settings.cut) {
    user.settings.field = user.settings.field.charAt(0); // get just first character instead of whole string
return user;


If you want to add computed properties to data at publish time, check the following articles: