Findwise/Hydra

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

Opened this issue · 0 comments

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.