Class: Faststep::Collection
- Inherits:
-
Object
- Object
- Faststep::Collection
- Defined in:
- lib/faststep/collection.rb,
ext/faststep/collection.c
Instance Attribute Summary collapse
- #name ⇒ Object readonly
Instance Method Summary collapse
- #count ⇒ Object
- #create_index ⇒ Object
- #drop ⇒ Object
- #find(selector = {}, options = {}) ⇒ Object
- #find_one(spec_or_object_id = nil, opts = {}) ⇒ Object
- #initialize ⇒ Object constructor
- #insert ⇒ Object
- #ns ⇒ Object
- #remove ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ Object
Instance Attribute Details
#name ⇒ Object (readonly)
Instance Method Details
#count ⇒ Object
#create_index ⇒ Object
#drop ⇒ Object
#find(selector = {}, options = {}) ⇒ Object
3 4 5 |
# File 'lib/faststep/collection.rb', line 3 def find(selector = {}, = {}) Cursor.new(self, "selector" => selector) end |
#find_one(spec_or_object_id = nil, opts = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/faststep/collection.rb', line 7 def find_one(spec_or_object_id=nil, opts={}) spec = case spec_or_object_id when nil {} when BSON::ObjectId {:_id => spec_or_object_id} when Hash spec_or_object_id else raise TypeError, "spec_or_object_id must be an instance of ObjectId or Hash, or nil" end find(spec, opts.merge(:limit => -1)).first end |