通过聚合的mongo db中的总数

时间:2018-07-14 08:16:17

标签: mongodb

我是mongodb的新手。我想通过他们的航班ID查询用户的总航班。我的字典数据是:  -列表项

{ 
"_id" : ObjectId("5b28bef9d7a0b65a18cfa8d8"), 
"user" : ObjectId("5b28a943e418034f3e61b0fb"), 
"flights" : [
    {
        "addedSource" : "EMAIL", 
        "bookedOn" : ISODate("2018-06-20T14:32:09.000+0000"), 
        "_id" : ObjectId("5b2a647e74f7ee31aea6838b"), 
        "flightId" : ObjectId("5b28ebccab3dd8097abff483")
    }, 
    {
        "_id" : ObjectId("5b3251f81e91770ca39b2ef5"), 
        "flightId" : ObjectId("5b28fd95be68b90f0c90793a")
    }
], 
"__v" : NumberInt(4), 
"createdAt" : ISODate("2018-06-20T14:26:33.643+0000"), 
"tripName" : "seter", 
"updatedAt" : ISODate("2018-06-27T06:41:53.418+0000")

}

0 个答案:

没有答案