MongoDB how crazy indexes do you have?

I have a product collection, which allows users to filter/sort on 12 criterias. I think to cover all queries, I need to create about 50 indexes. :joy:
I don’t know if mongodb can handle those amount of queries well.

It sounds like you might want to re-think your data structure :stuck_out_tongue:

3 Likes

You’re not quite there, yet:

https://docs.mongodb.com/manual/reference/limits/

1 Like

the indexes they look very similar. For example, you have to create 2 indexes for 2 sorting queries.
.sort({a: 1, b: 1})
and
.sort({b: 1, a: 1})

A single collection can have *no more* than 64 indexes.
I’m almost there.

1 Like