MongoDB Compound Indexes - Does the sort order matter?
问题 I've dived recently into mongodb for a project of mine. I've been reading up on indexes, and for a small collection, i know it wouldn't matter much but when it grows there's going to be performance issues without the right indexes and queries. Lets say i have a collection like so {user_id:1,slug:'one-slug'} {user_id:1,slug:'another-slug'} {user_id:2,slug:'one-slug'} {user_id:3,slug:'just-a-slug} And i have to search my collection where user id == 1 and slug == 'one-slug' In this collection,