我有一个'Session'集合,我希望得到一个Exit页数,它是会话中基于并发时间戳的最后一页。
{
"_id" : "51D0DF0B0714F3F3B0A0762092BD5993_tlpns1c2b1",
"loginId" : "-19015907",
"pages" : {
"consumermx" : {
"ClientA" : {
"activity_earnActivity" : NumberLong(1378086283000),
"memberProfile_editAccountProfile" : NumberLong(1378086286000),
"memberDashboard_editDashboard" : NumberLong(1378086282000)
}
}
}
}
{
"_id" : "E447A3356202AFFB2B67908895EFC191_tlpns1c6b16",
"loginId" : "-22851219",
"pages" : {
"consumermx" : {
"ClientA" : {
"item_editNewSearchByCategory" : NumberLong(1378086288000),
"memberProfile_editAccountProfile" : NumberLong(1378086345000),
"memberProfile_editPreferencesAssociation" : NumberLong(1378086279000),
"ssoClient_login" : NumberLong(1378086225000)
}
}
}
}
这是我尝试过的但没有用的:
db.Session.aggregate ([
{$match: {"pages.consumermx.NFCU.memberProfile_editAccountProfile":
{$gte : 1378353600000, $lte : 1378440000000}}},
{$sort: {"pages.consumermx.NFCU.memberProfile_editAccountProfile": -1}},
{$limit: 1},
{$group: { _id: null, count: { $sum: 1 }}}
])