Modelence lets you configure indexes directly on eachDocumentation Index
Fetch the complete documentation index at: https://docs.modelence.com/llms.txt
Use this file to discover all available pages before exploring further.
Store. Use:
indexesfor regular MongoDB indexes (performance and constraints)searchIndexesfor MongoDB Atlas SearchindexCreationModeto control startup behavior
MongoDB Indexes
Configure indexes to improve query performance:Starting from
modelence@0.12.0, Modelence manages framework-created indexes
using this strategy.Modelence manages framework-created indexes with a _modelence_ name prefix.
If you provide name, Modelence still prefixes it automatically.
During startup reconciliation, Modelence will create missing managed indexes,
drop outdated managed indexes, and recreate changed ones._modelence_ prefix are preserved unless
they conflict with code-defined index keys.
Common Index Options
indexes accepts MongoDB index options like unique, sparse,
expireAfterSeconds, and partialFilterExpression:
Index Creation Mode
By default, store indexes are created in the background during startup.Set
indexCreationMode: 'blocking' for indexes that must be created before startup continues.
blockingindexes are awaited before migrations begin.- Migrations are then started.
backgroundindexes may continue running in parallel with migrations.
indexes lock so only one instance performs reconciliation at a
time.
If index creation fails for a store, startup continues and a warning is logged.
MongoDB Atlas Search Indexes
For advanced full-text search capabilities using MongoDB Atlas Search, configure search indexes:Using Search Indexes
Once configured, use the search indexes with MongoDB’s aggregation pipeline:Search indexes require MongoDB Atlas. They are automatically created when your
application starts, similar to regular indexes.
Vector Search Indexes
For Atlas Vector Search, you can define a vector index insearchIndexes: