Skip to content

DocumentFiles stored in MongoDB should have an index on the document field #338

Description

@laserval

Attatchments, i.e. DocumentFiles, are stored using GridFS in MongoDB, which creates a separate dbobject in the collection documents.files containing the file metadata. In this dbobject, the document that this attachment belongs to is stored in the document field. Queries on this field can be expensive, as it is not indexed.

We've seen queries taking several seconds, which were completely eliminated by setting an index on the document field.

One risk with introducing more indexes in Hydra is that each stage currently creates a new index (see #230 ). An additional index on the attachments will decrease the max number of stages by 1.

It might also be relevant to create an index on the filename, or a compound index on document ID and filename.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions