mongoose default value equal to other value

You can pass a function to default, following is a schema field excerpt:

username: {
    type: String,
    required: true,
    // fix for missing usernames causing validation fail
    default: function() {
        const _t = this as any; // tslint:disable-line
        return _t.name || _t.subEmail;
    }
},

use the pre middleware explained here

userSchema.pre('save', function (next) {
    this.screenname = this.get('_id'); // considering _id is input by client
    next();
});