Class: Kabutops::Adapters::Mongo
- Inherits:
-
DatabaseAdapter
- Object
- Base
- DatabaseAdapter
- Kabutops::Adapters::Mongo
- Includes:
- Extensions::Parameterable
- Defined in:
- lib/kabutops/adapters/mongo.rb
Instance Attribute Summary
Attributes inherited from DatabaseAdapter
Instance Method Summary collapse
Methods included from Extensions::Includable
Methods inherited from DatabaseAdapter
Methods included from Extensions::CallbackSupport
Methods included from Extensions::Logging
Methods inherited from Base
#debug, #enable_debug, #initialize
Constructor Details
This class inherits a constructor from Kabutops::Adapters::Base
Instance Method Details
#nested? ⇒ Boolean
24 25 26 |
# File 'lib/kabutops/adapters/mongo.rb', line 24 def nested? true end |
#store(result) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kabutops/adapters/mongo.rb', line 12 def store result existing = collection.find('id' => result[:id]) if existing.count > 0 existing.each do |document| collection.update({'_id' => document['_id']}, result.to_hash) end else collection.insert(result.to_hash) end end |