Multikey array max size for good performance

In the multikey section, it was said it’s not recommended to have large arrays to index, my question is what is the alternative to this or if this kind of schema would have any sort of performance issue:

A user may have preferences in an array like [“Hockey”, “Basketball”…], not more than 30 elements, if the biggest use case for the app is quering for this preferences, will indexing this array be ok?

Hey @jaime_FH_66932

An alternative would be to remodel your schema.

Performance would have to be tested by looking at explain plans. I wouldn’t consider 30 to be big, but again big is subjective. You can also enforce limits on the array size to ensure that it remains within known limits.

1 Like

I have an array of string sizes less than 120, is it feasible to create a multikey index on this and the number of my document would be around 1M or more. and the tier I would be using is m30-m60.
If I am more concise then I will be spitting the name of the person into an array-like Anshul => [“a”,“an”,“ans”,“ansh”,“anshu”,“anshul”]
So as per my assumption, name of the person can’t go beyond 120 characters