Changed parameters for find in collection

This commit is contained in:
Adrian Madrid 2008-12-08 14:40:49 -07:00
parent 2d90d45c74
commit ee1ae4a3ca

View File

@ -26,9 +26,9 @@ module XGen
@name = name @name = name
end end
def find(selector={}, fields=nil, options={}) def find(selector={}, options={})
fields = nil if fields && fields.empty? options = { :fields => nil, :offset => 0, :limit => 0, :sort => nil}.update(options)
@db.query(@name, Query.new(selector, fields, options[:offset] || 0, options[:limit] || 0, options[:sort])) @db.query(@name, Query.new(selector, options[:fields], options[:offset], options[:limit], options[:sort]))
end end
def insert(*objects) def insert(*objects)