I started to run a simple hello world project using lb4. I created a basic mongodb datasource, and a repository and a simple model (username, password and id) for users with cli command provided by loopback. I also created a user controller, with a built in crud choice provided by loopback.
as you may know, this is a very basic setup but if anyone needs details, I will provide, just comment.
the problem is that, when I try to make new users using explorer, I encounter with duplicate same username models. means that:
{
"_id" : ObjectId("5def4581f7f9d508b0da2d4c"),
"username" : "string",
"password" : "string"
}
and:
{
"_id" : ObjectId("5def4584f7f9d508b0da2d4d"),
"username" : "string",
"password" : "string"
}
the client should enter unique username for signup. that's obvious.
how can I specify uniqueness of a property of a model in loopback 4 (without declaring it as id)?