Module: Candy::Crunch
- Included in:
- CandyArray, CandyHash, Piece
- Defined in:
- lib/candy/crunch.rb
Overview
All of the hard crunchy bits that connect us to a collection within a Mongo database.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#findAndModify(query, update, sort = {}) ⇒ Object
We’re implementing FindAndModify on Mongo 1.4 until the Ruby driver gets around to being updated…
Class Method Details
.included(receiver) ⇒ Object
228 229 230 |
# File 'lib/candy/crunch.rb', line 228 def self.included(receiver) receiver.extend ClassMethods end |
Instance Method Details
#findAndModify(query, update, sort = {}) ⇒ Object
We’re implementing FindAndModify on Mongo 1.4 until the Ruby driver gets around to being updated…
217 218 219 220 221 222 223 224 225 |
# File 'lib/candy/crunch.rb', line 217 def findAndModify(query, update, sort={}) command = OrderedHash[ findandmodify: self.collection.name, query: query, update: update, sort: sort ] result = self.class.db.command(command) end |