如何找到元素数组的匹配

时间:2019-04-05 05:45:37

标签: mongoose

我正在尝试使用MongoDB过滤数据

 let contactsAfterFilter = await Contact.aggregate([
  {
        $project: {
            createdAt: 1,
            gender: 1,
            customer_phone: 1,
            customer_name: 1,
            customer_email: 1,
            birthday_date: 1,
            anniversary_date: 1,
            source_type: 1,
            tags: 1,
            bday: {"$month": '$birthday_date'},
            aday: {"$month": '$anniversary_date'}
        }
    },
    {
        $match: {"$and": {$in: ["test1", "test2"]}}
    },
    {
        $project: {
            createdAt: 1,
            gender: 1,
            customer_phone: 1,
            customer_name: 1,
            customer_email: 1,
            birthday_date: 1,
            anniversary_date: 1,
            source_type: 1,
            tags: 1
        }
    },
]);

但它返回一个空数组

{{1}}

0 个答案:

没有答案