Add Indexes to MongoDB for General Ledger
Add indexes that are used for General Ledger (GL) information processing to the collections of your MongoDB system. Add these indexes only if you require GL posting and plan to use the MATRIXX GL utilities to process and post GL information. If you use multi-tenancy, you must add indexes for each MongoDB-based Event Repository.
About this task
MATRIXX Support recommends that you perform this task as part of your initial setup of each of your Event Repositories and before you begin loading event objects into its event collection (EventCollection). However, MongoDB users and indexes required for GL information processing can be added to your MongoDB system at any time.
Procedure
-
On your primary MongoDB server, start the MongoDB mongo shell.
mongo
-
Enter the following commands to add GL-processing related indexes
to the event collections in the
Event Repository.
Note: Although the examples used here refer to MtxEventDatabase or MtxGlDatabase, the tenant Event Repository name could be any name you define. The tenant GL database name is MtxGlDatabase concatenated with tenantId. For example, if tenantId is Foo, then the tenant GL database name is MtxGlDatabaseFoo.For every existing event collection (partition), confirm the following index exists. If the index does not exist, create it manually:
use MtxEventDatabase db.EventCollection.createIndex({GlDate: 1, WalletOwnerId: 1, EventType: 1, EventTime: 1})
For future event collections (partitions) created using create_event_repository_partitions.py, enter the following commands to add the index definition to the Event Repository configuration:use MtxEventDatabase db.EventStoreConfigurationCollection.insert({DocType: "EventStoreCollectionIndex", ConfigModification: {Version:1, Timestamp: ISODate()}, key: {GlDate: 1, WalletOwnerId: 1, EventType: 1, EventTime: 1}})
-
Enter the following commands to add GL-processing required indexes to the GL collection:
use MtxGlDatabase db.GlCollection.createIndex({GlDate: 1, WalletOwnerId: 1})
-
Enter the following commands to add an index to remove GL summary data from the GL collection after 90 days:
use MtxGlDatabase db.GlCollection.createIndex({GlDate: 1}, {expireAfterSeconds: 7776000})
What to do next
If you use multi-tenancy, on the MongoDB instance used for each tenant, you would:
After manually adding any index definitions, MATRIXX Support recommends that you
run the check_event_repository_configuration.py script to view all index definitions.- Add an index keyed on GlDate, WalletOwnerId, EventType, and EventTime to the event collections in the tenant's Event Repository.
- Add an index keyed on GlDate and WalletOwnerId to the GlCollection collection in the tenant's GL database.
- Add a TTL index keyed on GlDate to the GlCollection collection in the tenant's GL database.