Not sure if this can be done, so thought I would ask.
I have the following mongodb/s
{
\"store\":\"abc\",
\"offers\":[{
\"spend\":\"100.00\",
Amazingly, yes, mongodb can do this:
// Sort ascending, by minimum percentage value in the docs' offers array.
db.collection.find({}).sort({ 'offers.percentage': 1 });
// Sort descending, by maximum percentage value in the docs' offers array.
db.collection.find({}).sort({ 'offers.percentage': -1 });