Try this:
db.collection.aggregate([
{$unwind: "$carrier"},
{$sort: {"carrier.name": 1}},
{$group: {_id: "$_id", carrier: {$push: "$carrier"}}}
])
solved How to sort 1000000 elements array in alphanumeric in mongodb
Try this:
db.collection.aggregate([
{$unwind: "$carrier"},
{$sort: {"carrier.name": 1}},
{$group: {_id: "$_id", carrier: {$push: "$carrier"}}}
])
solved How to sort 1000000 elements array in alphanumeric in mongodb