Skip to content

Excesive calls to ensureIndexes() for any DB usage #15

@alejavigo

Description

@alejavigo

Morhpia ensureIndexes() method is being called in every Datastore creation , and that meand for every injection of DB Repositories or DB usage. That will send createIndex commands in every use of the DB for all the fields of entities annotated as @indexed. This will be a lot of duplicated commands that the DB will ignore quickly, but can affect greatly if there is high latency between App and DB.
EnsureIndexes is only needed and should be called just once at the loading of the app and/or plugin.

File: org.seedstack.mongodb.morphia.internal.DatastoreFactory
Method: createDatastore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions