Pro Couchbase Development by Deepak Vohra

Pro Couchbase Development by Deepak Vohra

Author:Deepak Vohra
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


If the get method is invoked on key not defined in the Couchbase Server the Couchbase::Error::NotFound error is generated. To demonstrate delete the document with ID catalog2 and run the following script.

require 'rubygems'

require 'couchbase'

client = Couchbase.connect(" http://127.0.0.1:8091 ")

print client.get("catalog2")

The Couchbase::Error::NotFound error gets generated as shown in Figure 5-28.

Figure 5-28.Couchbase::Error::NotFound error

Updating a Document

The replace method may be used to replace a key-value pair. The set method may also be used to update the value of a key already in the server to a new value. The replace method has the following signature.

object.replace(key, value [, ruby-replace-options ])

The replace method returns the CAS value of the object stored as a fixed number. The method args are discussed in Table 5-3.Table 5-3.The replace method Arguments



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.