In mangoDB -3.0.7 i have created a index with 2 fields. I can run the sort on those fileds When i give only ascending/descending. Example
{ a: 1, b: 1 }
But i when i run query like,
{ a: 1, b: -1 }
{ a: -1, b: 1 }
I am getting the following error,
Error: error: {
"$err" : "Executor error: Overflow sort stage buffered data usage of 33554499 bytes exceeds internal limit of 33554432 bytes",
"code" : 17144
}
I found this : https://docs.mongodb.com/manual/tutorial/sort-results-with-indexes/#sort-and-index-prefix
How can i do this kind of sort in MongoDB. ? How to create index / any workaround for this ?