Class: Exwiw::MongoQuery::Find

Inherits:
Struct
  • Object
show all
Defined in:
lib/exwiw/mongo_query.rb

Overview

timeout_ms is the per-collection, server-enforced operation timeout (CSOT) applied when this query runs; nil falls back to the client-wide global (ConnectionConfig#mongodb_query_timeout_ms) or, if that is also unset, no timeout. Omitted from #to_h when nil so the historical 4-key query shape is unchanged for collections without a timeout.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject

Returns the value of attribute collection

Returns:

  • (Object)

    the current value of collection



10
11
12
# File 'lib/exwiw/mongo_query.rb', line 10

def collection
  @collection
end

#filterObject

Returns the value of attribute filter

Returns:

  • (Object)

    the current value of filter



10
11
12
# File 'lib/exwiw/mongo_query.rb', line 10

def filter
  @filter
end

#primary_keyObject

Returns the value of attribute primary_key

Returns:

  • (Object)

    the current value of primary_key



10
11
12
# File 'lib/exwiw/mongo_query.rb', line 10

def primary_key
  @primary_key
end

#projectionObject

Returns the value of attribute projection

Returns:

  • (Object)

    the current value of projection



10
11
12
# File 'lib/exwiw/mongo_query.rb', line 10

def projection
  @projection
end

#timeout_msObject

Returns the value of attribute timeout_ms

Returns:

  • (Object)

    the current value of timeout_ms



10
11
12
# File 'lib/exwiw/mongo_query.rb', line 10

def timeout_ms
  @timeout_ms
end

Instance Method Details

#to_hObject



11
12
13
14
15
16
17
18
# File 'lib/exwiw/mongo_query.rb', line 11

def to_h
  {
    collection: collection,
    primary_key: primary_key,
    filter: filter,
    projection: projection,
  }.tap { |h| h[:timeout_ms] = timeout_ms unless timeout_ms.nil? }
end