I have a collection like :
{"x":{"y":[
{"date":ISODate("2014-07-24T21:00:00.000Z"),"k":5 },
{"date":ISODate("2014-07-22T21:00:00.000Z"),"k":6 } ] }}
I want to sort y array according to "date" parameter.So i made the code like this :
query.with(new Sort(Sort.Direction.ASC, "y.date"));
I want to output like this:
{"x":{"y":[
{"date":ISODate("2014-07-22T21:00:00.000Z"),"k":5 },
{"date":ISODate("2014-07-24T21:00:00.000Z"),"k":6 } ] }}
How can i make the output like this ? is the code that i made ,it is ok ?