Zapytanie pokazuje czasy odpowiedzi HSM w sekundach. Wyniki posortowane są malejąco. W miejsce [NAZWA KOLEKCJI] należy umieścić odpowiednią kolekcję.
DBQuery.shellBatchSize=500;
db.getCollection('[NAZWA KOLEKCJI]').aggregate([
{
$match:
{'message': /hsm/i ,'details.correlationId':{$exists:true}}
},
{
$group: {
_id: '$details.correlationId',
maxDate: { $max: '$date' },
minDate: { $min: '$date' },
count: { $sum: 1 }
}
},
{
$project:{
'when':'$minDate',
'duration': { $divide: [{ $subtract:[ '$maxDate', '$minDate' ] }, 1000] }
}
},
{
$sort: { duration:-1 }
}
])