Method: Moped::Query#select

Defined in:
lib/moped/query.rb

#select(select) ⇒ Query

Set the fields to include or exclude from the query.

Examples:

Select the fields to include or exclude.

db[:people].find.select(name: 1).one # => { name: "John" }

Parameters:

  • select (Hash)

    The inclusions or exclusions.

Returns:

Since:

  • 1.0.0



369
370
371
372
# File 'lib/moped/query.rb', line 369

def select(select)
  operation.fields = select
  self
end