Email would need to be unique across IndividualUsers & OrganizationalUsers.
We need to decide if we let Mongo handle the error OR use this library to handle with a library: https://www.npmjs.com/package/mongoose-unique-validator
IMO we should add the constraint and try to prevent the error by using a validator
@joaofnds so is using the library referenced above best or do you have another suggestion?
We can start implementing the mongoose-unique-validator or https://mongoosejs.com/docs/api/model.html#model_Model.exists,
I can start implementing the first one and see how it goes...
I think this can be done in the model set-up, the email field should have a unique property to its field, and then we could use a the packageabove, I think, this should have been in the set-up all along from the start.
what's up with this?
what's up with this?
You mean who's working on it and what's the status? Not sure. @Naraujo13 not sure if you were planning to look into this. Otherwise, @adisen feel free to take it on! (message on Slack with further details)
I'm on it, should submit a PR today!
Most helpful comment
I think this can be done in the model set-up, the email field should have a unique property to its field, and then we could use a the
packageabove, I think, this should have been in the set-up all along from the start.