我有一个带有多个嵌入式模型的模型。我需要查询一条记录以查看它是否存在。问题是我必须包含对多个嵌入文档的引用,我的查询必须包含以下参数:
{
"first_name"=>"Steve",
"last_name"=>"Grove",
"email_addresses"=>[
{"type"=>"other", "value"=>"steve@stevegrove.com", "primary"=>"true"}
],
"phone_numbers"=>[
{"type"=>"work_fax", "value"=>"(720) 555-0631"},
{"type"=>"home", "value"=>"(303) 555-1978"}
],
"addresses"=>[
{"type"=>"work", "street_address"=>"6390 N Main Street", "city"=>"Elbert", "state"=>"CO"}
],
}
即使缺少某些字段(例如 _id 和关联),我如何查询所有嵌入式文档?