名前フィールドだけを持つプロジェクト モデルがあり、そこには line_items へのリレーションも埋め込まれています。クラス プロジェクト インクルード mongoid::document フィールド :name embeddeds_many :line_items end
class LineItem
include mongoid::document
field :title
embedded_in :project, :inverse_of => :line_items
end
これはmongoドライバーの質問だと思います:もし私がそのような文書を持っていたら
db.project.find()[0]
{
_id : 123,
name : "housework",
line_items:[
{ title : "clean fridge", _id : 601},
{ title : "clean tub", _id : 602},
{ title : "clean oven", _id : 603}
]
}
- 1) mongo コンソールで ID 601 の項目を更新するにはどうすればよいですか?
- 2) どうすれば削除できますか?
ありがとう!