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

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

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -