我有一個模型與幾個嵌入式模型。我需要查詢記錄以查看它是否存在。問題是,我將不得不包括提及多個嵌入文檔我的查詢必須包括以下PARAMS:Mongoid複雜查詢包含嵌入式文檔
{
"first_name"=>"Steve",
"last_name"=>"Grove",
"email_addresses"=>[
{"type"=>"other", "value"=>"[email protected]", "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缺少這樣和聯想?
我很想看看js標準會是什麼樣子的例子。 –
對不起@JasonWaldrip我的mongodb foo不是那麼好。 :) – TCopple