lib/query.rb
def execute(reduce: false, autoload: true )
#      unless projection.nil?    || projection.empty?
      result = db.execute { compose }
			return nil unless result.is_a?(Array)
			block_given?  ? result.map{|x| yield x }  : result
#			return  result.first if reduce && result.size == 1
      ## case  select count(*) from  ...  --> [{ :count => n }]   projection is set
      ## case update ... after $current   --> [{ :$current => n}] projection is not set, but result is an integer
      #  separate key from  values and get model-files
#      if  !@q[:projection].empty?  && result.first.is_a?(Hash)  &&  result.first.values.is_a?( Array ) 
#        if reduce
#          result.first.values.map{|x| allocate_model x, autoload}
#        else
#          result.map{|_,m| allocate_model m, autoload }
#        end
#     eloe
 #      result.map{|y| allocate_model y, autoload }
 #     end
			## standard case: return Array
			#result.arcade_flatten
		end
# returns nil if the query was not sucessfully executed
returns nil if the query was not sucessfully executed
returns nil if the query was not sucessfully executed
def execute(reduce: false, autoload: true )
      result = db.execute { compose }
			return nil unless result.is_a?(Array)
			block_given?  ? result.map{|x| yield x }  : result
		end
def execute ( reduce : false , autoload : true ) result = db . execute { compose } return nil unless result . is_a? ( Array ) block_given? ? result . map { | x | yield x } : result end
returns nil if the query was not sucessfully executed
returns nil if the query was not sucessfully executed
#      unless projection.nil?    || projection.empty? #			return  result.first if reduce && result.size == 1 ## case  select count(*) from  ...  --> [{ :count => n }]   projection is set ## case update ... after $current   --> [{ :$current => n}] projection is not set, but result is an integer #  separate key from  values and get model-files #      if  !@q[:projection].empty?  && result.first.is_a?(Hash)  &&  result.first.values.is_a?( Array )  #        if reduce #          result.first.values.map{|x| allocate_model x, autoload} #        else #          result.map{|_,m| allocate_model m, autoload } #        end #     eloe #      result.map{|y| allocate_model y, autoload } #     end ## standard case: return Array #result.arcade_flatten
reduce
autoload