nedb
nedb copied to clipboard
How to make a field value is required(not empty)?
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?