Sha256: 81a30a72cc6f296f08a1eeda71a81c17d14446e620091403b190c844876832a2

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

#    Copyright 2020 Couchbase, Inc.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

require "couchbase"
include Couchbase # rubocop:disable Style/MixinUsage for brevity

options = Cluster::ClusterOptions.new
options.authenticate("Administrator", "password")
cluster = Cluster.connect("couchbase://localhost", options)
bucket = cluster.bucket("travel-sample")
collection = bucket.default_collection

res = collection.upsert("foo", {"bar" => 42})
p res.cas

res = collection.get("foo")
p res.content
p res.cas

res = collection.remove("foo")
p res

cluster.disconnect

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couchbase-3.0.0-universal-darwin-19 examples/crud.rb
couchbase-3.0.0 examples/crud.rb