0

我有一个“会话”集合,我想从其中获取退出页面的计数,其中它是基于并发时间戳的会话中的最后一页。

{
    "_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 }}}
])
4

0 回答 0