One of the most important things to get right when it comes to improving performance of your mongoDB database is database indexing. If your data isn’t indexed at all, every query will have to perform a full table scan to return even a single document, making your database slow. But if your data is indexed appropriately, the number of documents to scan to return a query result should be low, thereby, increasing performance.
The Nodechef platform can automatically profile your database using the MongoDB logs continuously and index your database automatically. This feature is not enabled by default and requires you enable it for your deployment.
Log into the dashboard on click on DB Actions → Slow Query Analyzer and Indexing. Toggle the Enable Automatic Indexing checkbox to yes to enable this feature. Note you will not be prompted to confirm this action.
Enabling this feature automatically creates any indexes suggested by the Slow Query Analyzer. Compound indexing and index intersection capabilities of MongoDB are both accounted for during index selection. Attributes selection is deterministic using the two variables the cardinality score of the attribute and operator precedence. You should notice a new collection with name "__NCCardinalityMatrix" in your database. This collection stores the cardinality matrix.