I would like to create an index such as
CREATE INDEX TestIndex ON Test(field) but I cannot query it directly without the condition
field IS NOT MISSING.
This is a problem because as schema changes and fields are added, old documents (with new fields missing) will not show up in the index.
Needless to say(?) it’s also annoying to always have to do IS NOT MISSING with every key on every index on every query. And God forbid I miss one and the query fails (because I’m not willing to succumb to using primary indices) or works with poor performance (unexpectedly) for those that do have primary indices.
Here is a use case: I have users in my system, and now want to mark some users as “special”. So I add a boolean field to all my users called “IsSpecial”. This works great when loading the document because if it’s missing, it deserializes to false (at least in my case), which is desired.
Only problem is, if I then add that field as a key to an index (for better coverage), all of my older users that have not been updated recently will have that value missing, rendering the index useless.
Any ideas on how to get around this?