php - mongoDB index strategy -
i have collection called post. have mapping system ensures each document has these fields: id (int) target (string) type (string) user_id client_id updated (string, 11 int timestamp) created (string, 11 int timestamp) enabled (bool) this collection accessed output in api schema. so typical requests might be: /post?type=image&user_id=2 /post?updated=35234423&order_by=client_id /post?enabled=true&order_by=id there no 100% guarantee fields make find or sort field. recently when table reached 8gb of data, started getting error: "localhost:27017: data sort() no index. add index or specify smaller limit" i have looked @ documentation mongo index , found difficult understand whether works in same way mysql index. some threads found on indexing: mongodb - data sort() no index error seem suggest using specific sort fields ensure index hit. cannot when alot of filtering , sorting optional. could suggest firm solution in terms of whether sho...