问题
Can somebody tell me please if is possible to make indexes in Mongodb more efficient in this case: I have database with 50 millions items. There are two indexes on fields "ico" and "publishDate". Ico is used for filtering and publishDate for sorting. Is it possible to make it like a compound index to be more efficient? Can I combine filtering and sorting in compound index? Is important to choose which one should be the first in index definition? It is little complicated cause I have not the collection on localhost.
回答1:
Create a compound index as {ico: 1, publishDate: 1}
. Refer to doc.
来源:https://stackoverflow.com/questions/54748271/mongodb-compound-indexes-for-filtering-and-sorting-on-big-collection