matteodelabre / mongoose-beautiful-unique-validation

Plugin for Mongoose that turns duplicate errors into regular Mongoose validation errors
MIT License
117 stars 38 forks source link

Self-referenced schemas trigger an exception #50

Closed jllodra closed 3 years ago

jllodra commented 6 years ago

Self-referenced schemas trigger an exception (max call stack size exceeded):

var zone = new Schema({
  name: {type: String, required: true},
  created_at: Date,
  updated_at: Date
});

zone.add({zones: [zone]});

Thank you.