Db.getcollection (' Rpcmonitor_request '). Find (
{
"Requeststarttime":
{
$GT: Isodate ("2018-05-14 02:00"),
$LT: Isodate ("2018-05-14 04:00")
},
"_id": ObjectId ("5af8fc5809d8d057f6a734e4")
})
Db.getcollection (' Rpcmonitor_request '). Aggregate (
[
{
$group:
{
requestcount:{$sum: 1},
_ID:
{
"Requestday": {$dateToString: {format: "%y-%m-%d", Date: "$RequestStartTime"}},
"Requesttypename": "$RequestTypeName",
"Requestmethodname": "$RequestMethodName"
}
}
}
])
Db.getcollection (' Rpcmonitor_request '). Aggregate (
[
{
$group:
{
requestcount:{$sum: 1},
_ ID:
{
"Requestday": {$dateToString: {format: "%y-%m-%d", Date: "$RequestStartTime"},
"Requesttypename": " $RequestTypeName ",
" Requestmethodname ":" $RequestMethodName "
}
}
},
{$project: {" _id ": 0," Requestday ":" $_id. Requestday "," Requesttypename ":" $_id. Requesttypename "," Count ":" $RequestCount "," Requestmethodname ":" $_id. Requestmethodname "}}
])
Db.getcollection (' Rpcmonitor_request '). Aggregate (
[
{$match: {
"Requeststarttime":
{
$GT: Isodate ("2018-05-14 02:00"),
$LT: Isodate ("2018-05-14 04:00")
}
}},
{
$group:
{
requestcount:{$sum: 1},
_ID:
{
"Requestday": {$dateToString: {format: "%y-%m-%d", Date: "$RequestStartTime"}},
"Requesttypename": "$RequestTypeName",
"Requestmethodname": "$RequestMethodName"
}
}
},
{$project: {"_id": 0, "Requestday": "$_id. Requestday "," Requesttypename ":" $_id. Requesttypename "," Count ":" $RequestCount "," Requestmethodname ":" $_id. Requestmethodname "}}
])
MongoDB Query Statement