0
Monogoid pluck返回嵌入字段的重複嵌入結果(不關注重複行)。monogid pluck返回嵌入/嵌套字段的重複結果
例如:(用戶嵌入文檔SomeModel)
SomeModel.where(condition).pluck(:region, "user.name", "user.lastname")
Results:
[["amr",
{"name" => "mark", "lastname" => "goodman"},
{"name" => "mark", "lastname" => "goodman"}],
["amr",
{"name" => "john", "lastname" => "cena"},
{"name" => "john", "lastname" => "cena"}]
]
我期待類似如下:
[["amr",
{"name" => "mark"},
{"lastname" => "goodman"}],
["amr",
{"name" => "john"},
{"lastname" => "cena"}]
]
同樣,如果我查詢從嵌入文檔多個字段,它會生成很多重複哈希。
不知道我在這裏做錯了什麼。