Sha256: 319f70067aff5a055b1f99b8e56ddaddfe89b57866fa33d07ac7775aa37db1ee

Contents?: true

Size: 643 Bytes

Versions: 18

Compression:

Stored size: 643 Bytes

Contents

require 'couchbase'

include Couchbase

options = Cluster::ClusterOptions.new
options.authenticate("Administrator", "password")
cluster = Cluster.connect("couchbase://localhost", options)

cluster.bucket("travel-sample") # this is necessary for 6.0.x

options = Cluster::QueryOptions.new
options.named_parameters({type: "hotel"})
options.metrics = true
res = cluster.query("SELECT * FROM `travel-sample` WHERE type = $type LIMIT 10", options)
res.rows.each do |row|
  puts "#{row["travel-sample"]["country"]}. #{row["travel-sample"]["name"]}"
end
puts "Status: #{res.meta_data.status}. Execution time: #{res.meta_data.metrics.execution_time}"

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
couchbase-3.0.0.beta.1-universal-darwin-19 examples/query.rb
couchbase-3.0.0.beta.1 examples/query.rb
couchbase-3.0.0.alpha.5-x86_64-linux examples/query.rb
couchbase-3.0.0.alpha.5-universal-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.5-x86_64-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.5 examples/query.rb
couchbase-3.0.0.alpha.4-x86_64-linux examples/query.rb
couchbase-3.0.0.alpha.4-x86_64-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.4-universal-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.4 examples/query.rb
couchbase-3.0.0.alpha.3-x86_64-linux examples/query.rb
couchbase-3.0.0.alpha.3-x86_64-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.3-universal-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.3 examples/query.rb
couchbase-3.0.0.alpha.2-x86_64-linux examples/query.rb
couchbase-3.0.0.alpha.2-x86_64-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.2-universal-darwin-19 examples/query.rb
couchbase-3.0.0.alpha.2 examples/query.rb