What is the best way to make a field based on another field?

Hi, I am new to Meteor and Simpl-Schema. I am going to create a collection in MongoDB like ‘user’. In this collection, I am going to create a field called name and another field called nameToLowerCase. Field nameToLowerCase is depend on field name. So, when insert/update a document, field nameToLowerCase will get autoValue of the lower case of field name.

I wrote the code like this,

UserSchema = new SimpleSchema({
name: {
type: String,
min: 1,
max: 70,
regEx: unicodeRegex,
nameToLowerCase: { // used for sorting
type: String,
optional: true,
autoValue() {
if (!this.isSet && this.field(‘name’).isSet) {
return this.field(‘name’).value.toLowerCase();
return null;

But, field nameToLowerCase always give me null. I checked it because of this.field(‘name’).isSet is false. But in the mongoDB, field name has value.

What’s wrong with this?

Thanks a lot.

autoValue: () => {/*...*/}
// or

autoValue: function () {/*...*/}