What are the valid Connection.add options?


#1

Are the options documented somewhere ?

The reason I ask is because I want to do is set an option that will ensure the document is persisted to disk before returning. What I did was set the persist_to option to a number >=1. I think that should do it, but I just want to confirm that is the correct option.

/**

  • Like {@linkcode Connection#set} but will fail if the key already exists.
  • @param {string} key
  • @param {string|object|Buffer} value
  • @param {object=} options
  • @param {integer} options.expiry
  • @param {integer} options.flags
  • @param {string|integer} options.format
  • @param {integer} options.persist_to
  • @param {integer} options.replicate_to
  • @param {KeyCallback} callback
  • @see Connection#set
  • @see Connection#addMulti
    */
    Connection.prototype.add = function(key, value, options, callback) {
    this._invokeStorage(this._cb.addMulti, arguments);
    };

#2

Hello,

So the important options/parameters are:

  • expiry : time to live (TTL),time before the key/document is deleted from Couchbase
  • flags : usually something internal you should not need it
  • Format : Used to set the format of the value you want to save see http://www.couchbase.com/autodocs/couchbase-node-client-1.2.0/global.html
  • persist_to : durability constraints, that check if the document has been saved to disk on x nodes
  • replicate_to : durability constraints, that check if the document has been replicated, in memory on x nodes

Note the durability constraints, do not “force” the write, just allow you to check if this is done, see http://docs.couchbase.com/couchbase-devguide-2.2/#monitoring-data-using-observe

Regards
Tug
@tgrall