Class: Couchbase::Options::Get
Overview
Options for Collection#get
Instance Attribute Summary collapse
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize(projections: [], with_expiry: false, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Get
constructor
Creates an instance of options for Collection#get.
-
#project(*paths) ⇒ Object
Allows to specify a custom list paths to fetch from the document instead of the whole.
Constructor Details
#initialize(projections: [], with_expiry: false, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Get
Creates an instance of options for Collection#get
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/couchbase/options.rb', line 73 def initialize(projections: [], with_expiry: false, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span) @projections = projections @with_expiry = with_expiry @transcoder = transcoder @preserve_array_indexes = false yield self if block_given? end |
Instance Attribute Details
#transcoder ⇒ JsonTranscoder, #decode(String, Integer)
59 60 61 |
# File 'lib/couchbase/options.rb', line 59 def transcoder @transcoder end |
#with_expiry ⇒ Boolean
58 59 60 |
# File 'lib/couchbase/options.rb', line 58 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.
94 95 96 97 |
# File 'lib/couchbase/options.rb', line 94 def project(*paths) @projections ||= [] @projections |= paths.flatten # union with current projections end |