In practice, I use throwing out meta
in combination with other queries and/or aggregation stages. I did not initially write about this so as not to distract from the main issue.
Let’s say we have such query:
{'meta': {'$exists': false}, 'POS': {'$nin': [10438, 10440, 10441]}}
…and there is a POS
only index. Spoiler: “Explain plan” really shows that IXSCAN is involved. But I don’t understand how it works. Without an index of meta
, how does the DBMS know that the corresponding document is the only one and is located only at the beginning of collection? Only the creator of the database knows that meta
appears once and is always in the first position. In theory, without an index, the engine should walk through absolutely all documents to make sure there is no meta
field in unexpected places in the collection.
A bioinformatic table/collection can have a rich history, and a good practice in this science is to store the info about the origin of table in meta-strings.