Take this sample pipeline:
[
{
'$sort': {
'date.dates': -1
}
}, {
'$project': {
'code': '$code.label',
'companyName': '$company.label',
'announcement': '$title.label',
'announcementLink': {
'$arrayElemAt': [
'$title.links', 0
]
},
'date': {
'$arrayElemAt': [
'$date.dates', 0
]
},
'announcementType': '$type.label',
'announcementDetail': '$announcementDetail',
'announcementDocuments': '$announcementDocuments',
'md5': '$md5'
}
}
]
I'm finding that on this particular version of Compass it seems that when this pipeline is saved as a view. The sorting that should be applied simply isn't. No errors, no reason why... as a workaround, I have to add manually add {date: -1} to the sort field when viewing the view's documents.
I've noticed that this is also happening when connecting to our production servers as well.