Skip to content

Instantly share code, notes, and snippets.

@tobowers
Created April 18, 2011 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobowers/925587 to your computer and use it in GitHub Desktop.
Save tobowers/925587 to your computer and use it in GitHub Desktop.
ruby-1.8.7-p334 :022 > col.update({:_id => id}, {:test => 0})
=> 105
ruby-1.8.7-p334 :023 > col.update({:_id => id}, {"$inc" => {:test => 7599434616}})
=> 120
ruby-1.8.7-p334 :024 > col.find({:_id => id}).first
=> {"_id"=>BSON::ObjectId4dac55a85fedbd37dd000001, "test"=>-990499976}
ruby-1.8.7-p334 :025 > col.update({:_id => id}, {:test => 0})
=> 105
ruby-1.8.7-p334 :028 > col.update({:_id => id}, {"$inc" => {:test => 7599434616.0}})
=> 120
ruby-1.8.7-p334 :029 > col.find({:_id => id}).first
=> {"_id"=>BSON::ObjectId4dac55a85fedbd37dd000001, "test"=>7599434616.0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment