0

I want to do sorting through Java map reduce in mongo. How to pass the sort query through Java API?

I am using this command:

{
    "mapreduce": "orders",
    "map": "function map(){
        var items_out={ items:[] };
        for(i in this.items){
            items_out.items.push(this.items[i].sku);
        };
        emit(this._id,items_out);
    }",
    "reduce": "function reduce(key,values){
        return values;
    }",
    "verbose": true,
    "out": {
        "merge": "map_reduce"
    },
    "query": {
        "$sort": {
            "items.sku": 1
        }
    }
}

But "$sort" dosen't work.

Miguel Cartagena
  • 2,576
  • 17
  • 20
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29

0 Answers0