3
我成功地使用MongoMapper内置的用于原子“$推”和“$集”的支持,但无法弄清楚“$拉”如何使用原子Pull删除MongoMapper中的嵌入式文档?
class Feed
include MongoMapper::Document
many :stories
end
class Story
include MongoMapper::EmbeddedDocument
key :title, String
end
feed = Feed.first
story = Story.new(:title => "Hello, world!")
Feed.push(feed.id, :stories => story.to_mongo) #works fine
Feed.set({:_id => feed.id, "stories.title" => "Hello, world!"}, "stories.$.title" => "Foo") #works fine
Feed.pull(???)
我怎样才能去除原子使用上拉一个故事?
这是关于StackOverflow的好东西。你也不得不回答这个问题,以便其他人也可以使用这些信息。谢谢! – 2011-07-09 08:09:35