MongoDB index: object keys vs array of strings MongoDB index: object keys vs array of strings mongoose mongoose

MongoDB index: object keys vs array of strings


In MongoDB creating indexes on an array of strings results into multiKey index where all the strings in the array form the index keys and point to the same document.So in your case it would work same as nested object keys.

If you go with boolean design and you can put index on visibility field.You can further read on MongoDB Mulitkey indexing