nedb icon indicating copy to clipboard operation
nedb copied to clipboard

How to make a field value is required(not empty)?

Open flight9 opened this issue 3 years ago • 0 comments

I think it's common that if we have a model called User, an email is required(not empty) when creating a new User Or we would stop the creating(like throw an error).

Is there a rule that can archieve this, like Index definition inside Nedb:

Model.ensureIndex({ fieldName: 'email', unique: true });

Model.ensureField({ fieldName: 'email', required: true }); //Is there a definition like this?

flight9 avatar Mar 17 '21 10:03 flight9