Can anyone indicate the right way to create an index for a field that is both sparse and unique, in Mongo Cloud, using the web interface?
Basically I want it so when a value is provided for the field it is unique, but it may be null and null does not count towards duplicates.
What I have tried:
{
"mobile": {
"sparse": true,
"unique": true
}
}
{
"mobile": ["sparse", "unique"]
}
Also this should have worked as basic.
{
"mobile": "unique"
}
No errors, but no index on mobile field either. I had one previously, but removed it since it was only set to unique.
The only possibility that could maybe be causing a problem (which it should not), is a text index “name_text_mobile_text”, given I just had a mobile only index before removing it for rebuilding?
I did try reading the documentation reference from the dialogue, but it doesn’t give anything useful contextually for the fields in that dialogue.