Class: Couchbase::Collection::GetOptions
- Inherits:
-
Couchbase::CommonOptions
- Object
- Couchbase::CommonOptions
- Couchbase::Collection::GetOptions
- Defined in:
- lib/couchbase/collection_options.rb
Instance Attribute Summary collapse
-
#transcoder ⇒ JsonTranscoder
Transcoder used for decoding.
-
#with_expiry ⇒ Boolean
If the expiration should also fetched with get.
Attributes inherited from Couchbase::CommonOptions
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize {|self| ... } ⇒ GetOptions
constructor
A new instance of GetOptions.
-
#project(*paths) ⇒ Object
Allows to specify a custom list paths to fetch from the document instead of the whole.
Constructor Details
#initialize {|self| ... } ⇒ GetOptions
Returns a new instance of GetOptions.
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
#transcoder ⇒ JsonTranscoder
Returns transcoder used for decoding.
27 28 29 |
# File 'lib/couchbase/collection_options.rb', line 27 def transcoder @transcoder end |
#with_expiry ⇒ Boolean
Returns 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.
44 45 46 47 |
# File 'lib/couchbase/collection_options.rb', line 44 def project(*paths) @projections ||= [] @projections |= paths.flatten # union with current projections end |