I have an index that looks like this:
{a: 1, b: 1}
And my query looks something like this:
db.myCollection.find({a: {$regex : "^S"}}).sort({b:1})
When I do an “explain” on this plan, I’m seeing a SORT stage which means it’s using CPU and memory to do the sorting rather than using the order of the index. Is there a way to make this work?