当对象字段具有数组对象时,如何在mongodb中查找记录

时间:2018-10-18 05:27:36

标签: mongodb

我想使用mongodb shell查询以下记录:-

{
 "_id" : 2201,
 "first_name" : "test",
 "last_name" : "test",
 "company_name" : "k company",
 "email_id" : "test@email.com",
 "dont_send_notification" : false,
 "emails" : [
    {
        "value" : "test@test.com",
        "note" : "",
        "send_notifications" : false
    }
 ],
 "phone_numbers" : [ ],
 "offline" : false
}

我想通过电子邮件获取记录,并且我在mongodb shell中使用的查询是db.users.find({emails:{$in:[{value:"test@test.com"}]}}).pretty(),但是此查询无法正常工作,有人可以告诉我如何进行查询以获取该记录

0 个答案:

没有答案
相关问题