lib/parse/query.rb
def keys(*fields)
      @keys ||= []
      fields.flatten.each do |field|
        if field.nil? == false && field.respond_to?(:to_s)
          @keys.push Query.format_field(field).to_sym
        end
      end
      @keys.uniq!
      @results = nil if fields.count > 0
      self # chaining
    end
def keys(*fields)
      @keys ||= []
      fields.flatten.each do |field|
        if field.nil? == false && field.respond_to?(:to_s)
          @keys.push Query.format_field(field).to_sym
        end
      end
      @keys.uniq!
      @results = nil if fields.count > 0
      self # chaining
    end
def keys ( * fields ) @keys ||= [ ] fields . flatten . each do | field | if field . nil? == false && field . respond_to? ( :to_s ) @keys . push Query . format_field ( field ) . to_sym end end @keys . uniq! @results = nil if fields . count > 0 self # chaining end
Restrict the fields returned by the query. This is useful for larger query
 results set where some of the data will not be used, which reduces network
 traffic and deserialization performance.
 @example
  # results only contain :name field
  Song.all :keys => :name

  # multiple keys
  Song.all :keys => [:name,:artist]
 @note Use this feature with caution when working with the results, as
    values for the fields not specified in the query will be omitted in
    the resulting object.
 @param fields [Array] the name of the fields to return.
 @return [self]
Restrict the fields returned by the query . This is useful for larger query results set where some of the data will not be used which reduces network traffic and deserialization performance . @example # results only contain : name field Song . all : keys = > : name