Class: Couchbase::Collection::GetOptions

Inherits:
Couchbase::CommonOptions show all
Defined in:
lib/couchbase/collection_options.rb

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]

30
31
32
33
34
35
36
# File 'lib/couchbase/collection_options.rb', line 30

def initialize
  @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:


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

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


24
25
26
# File 'lib/couchbase/collection_options.rb', line 24

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]

44
45
46
47
# File 'lib/couchbase/collection_options.rb', line 44

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