'How to make a model in loopback 4 to have unique values in its schema?

I am trying to find a way to have the same funtionality that happens when I put unique:true in express schema. How do I accomplish this in loopback 4. I tried putting unique true in the property decorator but it did not work.

@property({
    type: 'string',
    id: true,
    required: false,
    unique: true,
  })
  id: string;

This doesnt work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source