TTL index:
The TTL collection enables MongoDB to set the expiration time for stored data, after a specified period of time, or at a specified point in time, the collection is automatically cleared by Mongod. This feature facilitates the storage of some data that only needs to be kept for a certain amount of time, such as event data generated by the machine, logs, session information, and so on.
First create a collection ttlcol:
The TTL index is created and expires in 60 seconds.
After 60 seconds, the query found that the data was deleted.
Partial index:
The MongoDB partial index creates an index only for those documents that meet the specified filter criteria in a collection. Because part of the index is a subset of a collection document, some indexes have lower storage requirements and reduce the performance cost of index creation and maintenance. Partial indexes are created by specifying filter conditions and can use partial indexes for all index types supported by MongoDB.
After you force a partial index, you can only query the records of the rating>12.
Text index:
You can search for some of the words in the article:
TTL index of MongoDB Learning notes, partial index and text index