Substring a field inside a publish function


#1

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;

#2

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