Method: XGen::Mongo::Driver::Collection#save
- Defined in:
- lib/mongo/collection.rb
#save(object) ⇒ Object
Save an updated object to the collection, or insert it if it doesn’t exist already.
77 78 79 80 81 82 83 |
# File 'lib/mongo/collection.rb', line 77 def save(object) if id = object[:_id] || object['_id'] repsert({:_id => id}, object) else insert(object) end end |