json - How to sort a MongoDB document by its subdocument fields -


i'm trying order following document don't way it. need sort following mongodb document field attributes.k order (and order v).

    {         "_id" : objectid("55174192825a674422d29422"),                 "attributes" : [                 {                         "k" : "order",                                                 "v" : "2"                 },                 {                         "k" : "image",                                                 "v" : "550f3232f2bb54ac057883ab"                 }         ] }, {         "_id" : objectid("551741a2825a674422d29423"),           "attributes" : [                 {                         "k" : "order",                                                 "v" : "1"                 },                 {                         "k" : "image",                                                 "v" : "550f3283f2bb54ac057883b2"                 }         ] } 


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -