Hello, I'm trying to set up a unique entry on a collection where 2 attributes must be unique.
Specifically, in this screenshot, i want to have the combination of word
and users
to be unique per entry. For example:
Allowed: word: A, users: 1
Allowed: word: B, users: 1
Disallowed: word: A, users: 1. because the same value already being input earlier.
Sorry i can't find a way to do this. In index option, there is no option for reference. Any suggestion?
TL;DR
Developers want to create a unique index based on two reference attributes in a collection. They want to ensure that the combination of 'word' and 'users' is unique per entry. Unfortunately, there isn't an option for reference in the index settings.
Solution: The developers can achieve this by creating a compound index on both 'word' and 'users' attributes. This will enforce uniqueness on the combination of those two fields.