Alexandr T Alexandr T - 1 month ago 19
Ruby Question

Ruby: connect to Couchbase

I want to connect to Couchbase DB server trough couchbase gem.

require 'couchbase'
c = Couchbase.connect('http://<server>:<port>/pools/default/buckets/auth')


I get an error:

*** Couchbase::Error::BucketNotFound Exception: bootstrap error, The bucket requested does not exist


The following code works with the (couchbase python package):

from couchbase.bucket import Bucket
c = Bucket('couchbase://<server>/auth')


How I can connect from ruby by using connection string
couchbase://<server>/auth
?

Answer

Need specify bucket if it is custom:

Couchbase.connect("http://<server>:8091/pools/default", :bucket => 'auth')