Databases can have repeat data in them, but there are some pretty obvious cases where we don’t want 2 different entries to have the same values. (Here’s looking at you, user authentication). If our users log in with their email address, then we certainly don’t want to have more than 1 user record having the same email address.
So how do we enforce that with Mongoose?
In this episode we'll see how to ensure uniqueness of values in our MongoDB records.