Mongoose virtual fields included in toJSON by default: schemaOptions.toJSON.virtuals = true; still doesn’t include virtual fields by default

Just tried:

  var schemaOptions = {
    toObject: {
      virtuals: true
    }
  };

and worked! 😉

Now by default I use:

  var schemaOptions = {
    toObject: {
      virtuals: true
    }
    ,toJSON: {
      virtuals: true
    }
  };

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)