I am migrating Morphia from 1.6 to 2.4.
We are running the ensureIndexes on our application starting.
But, We caught warning messages as follow.
Mapper#map is configured in the config file and should not be called directly.
Then, I read the morphia document as follow. https://morphia.dev/morphia/2.4/javadoc/dev/morphia/Datastore.html#ensureIndexes()
I can see that I can config a ensureIndexes by a config file.
How can I config the ensureIndex by file?
You can create the MorphiaConfig
and programmatically and configure starting with MorphiaConfig.load()
. If you go the config file route, you can set morphia.apply-indexes=true
. The complete file structure can be seen here. The complete configuration docs can be found here