I have a mongo db collection for restaurants. e.g. {_id: uniquemongoid, rank: 3, city: 'Berlin' }
Restaurants are listed by city and ordered by rank (an integer) - should I create an index on city and rank, or city/rank compound? (I query by city and sort by rank)
Furthermore there are several fields with booleans e.g. { hasParking:true, familyFriendly:true } - should I create indexes to speed up queries for these filters? compound indexes? Its not clear for me if I should create compound indexes as the queries can have only one boolean set or more booleans set.
explain()method of cursor to check which index was used to fulfill a query. So when you aren't sure if a given index helps a specific query, you can try it out and check. - Philipp