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
end
def find(selector={}, fields=nil, options={})
fields = nil if fields && fields.empty?
@db.query(@name, Query.new(selector, fields, options[:offset] || 0, options[:limit] || 0, options[:sort]))
def find(selector={}, options={})
options = { :fields => nil, :offset => 0, :limit => 0, :sort => nil}.update(options)
@db.query(@name, Query.new(selector, options[:fields], options[:offset], options[:limit], options[:sort]))
end
def insert(*objects)