是否有可能通过习惯性 j子,如发现的_子,或更新。
具体案例一:我想到inc
。 a 符合标准的一组文件。
It looks like this is possible in MongoDB: http://www.mongodb.org/display/DOCS/Updating#Updating-ModifierOperations
db.people.update( { name:"Joe" }, { $inc: { created_at : -1 } } );
But I don t thing Mongoid allows it (it seems to only let you inc one document at a time). And their update_all
method I believe only can use $set. Thanks!
http://mongoid.org/docs/querying/modification.html
举例来说,这并不奏效。
User.where(:name => "Joe").update_all("{ $inc: { created_at : -1 } }")