Mongodb查询仅在条件与指定时间范围内匹配时才能获取集合

时间:2019-10-20 12:16:21

标签: mongodb

我在Mongdb中有以下收藏

[
    {
        "customer_id": "test1@gmail.com",
        "created": 1553082454,
        "event_name": "Add to Cart"
    },
    {
        "customer_id": "test2@gmail.com",
        "created": 1553082954,
        "event_name": "Add to Cart"
    },
    {
        "customer_id": "test1@gmail.com",
        "created": 1553089954,
        "event_name": "Add to Cart"
    },
    {
        "customer_id": "test1@gmail.com",
        "created": 1553089984,
        "event_name": "Add to Cart"
    },
    {
        "customer_id": "test1@gmail.com",
        "created": 1553090994,
        "event_name": "Purchased"
    },
    {
        "customer_id": "test2@gmail.com",
        "created": 1553342154,
        "event_name": "Purchased"
    }
]

我需要查询以获取所有客户的列表,其中“已购买”和“添加到购物车”之间的时差超过15分钟且具有指定范围(例如:最近30天内)。

[
    {
        "customer_id": "test1@gmail.com"
    }
]

0 个答案:

没有答案