我成功地使用了MongoMapper对原子“$push”和“$set”的内置支持,但无法弄清楚“$pull”
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( ??? )
如何使用拉动原子地删除故事?