Class: Couchbase::Collection::GetOptions

Inherits:
Couchbase::CommonOptions show all
Defined in:
lib/couchbase/collection_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/collection_options.rb
more...

Instance Attribute Summary collapse

Attributes inherited from Couchbase::CommonOptions

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ GetOptions

Returns a new instance of GetOptions.

Yield Parameters:

[View source]

32
33
34
35
36
37
38
39
# File 'lib/couchbase/collection_options.rb', line 32

def initialize
  super
  @transcoder = JsonTranscoder.new
  @preserve_array_indexes = false
  @with_expiry = nil
  @projections = nil
  yield self if block_given?
end

Instance Attribute Details

#transcoderJsonTranscoder

Returns transcoder used for decoding.

Returns:


29
30
31
# File 'lib/couchbase/collection_options.rb', line 29

def transcoder
  @transcoder
end

#with_expiryBoolean

Returns if the expiration should also fetched with get.

Returns:

  • (Boolean)

    if the expiration should also fetched with get


26
27
28
# File 'lib/couchbase/collection_options.rb', line 26

def with_expiry
  @with_expiry
end

Instance Method Details

#project(*paths) ⇒ Object

Allows to specify a custom list paths to fetch from the document instead of the whole.

Note that a maximum of 16 individual paths can be projected at a time due to a server limitation. If you need more than that, think about fetching less-generic paths or the full document straight away.

Parameters:

  • paths (String, Array<String>)

    a path that should be loaded if present.

[View source]

47
48
49
50
# File 'lib/couchbase/collection_options.rb', line 47

def project(*paths)
  @projections ||= []
  @projections |= paths.flatten # union with current projections
end