cursor.sort() kan sortera på flera fält men inte enkelt både dokument och underdokument samtidigt. Använd aggregation med unwind och sort.
db.col.aggregate({$unwind:'$subs'}, {$sort:{id:1,'subs.time':1}});
cursor.sort() kan sortera på flera fält men inte enkelt både dokument och underdokument samtidigt. Använd aggregation med unwind och sort.
db.col.aggregate({$unwind:'$subs'}, {$sort:{id:1,'subs.time':1}});