Commit 62bd25fe authored by Tristan Cavelier's avatar Tristan Cavelier

jio get API changed: jio.get("id"); -> jio.get({"_id": "id"});

parent a62101eb
...@@ -278,7 +278,8 @@ Object.defineProperty(that, "put", { ...@@ -278,7 +278,8 @@ Object.defineProperty(that, "put", {
/** /**
* Get a document. * Get a document.
* @method get * @method get
* @param {string} docid The document id: "doc_id" or "doc_id/attachmt_id". * @param {string} doc The document object. Contains at least:
* - {string} _id The document id: "doc_id" or "doc_id/attachment_id"
* @param {object} options (optional) Contains some options: * @param {object} options (optional) Contains some options:
* - {number} max_retry The number max of retries, 0 = infinity. * - {number} max_retry The number max of retries, 0 = infinity.
* - {string} rev The revision we want to get. * - {string} rev The revision we want to get.
...@@ -294,14 +295,14 @@ Object.defineProperty(that, "get", { ...@@ -294,14 +295,14 @@ Object.defineProperty(that, "get", {
configurable: false, configurable: false,
enumerable: false, enumerable: false,
writable: false, writable: false,
value: function (id, options, success, error) { value: function (doc, options, success, error) {
var param = priv.parametersToObject( var param = priv.parametersToObject(
[options, success, error], [options, success, error],
{max_retry: 3} {max_retry: 3}
); );
priv.addJob(getCommand, { priv.addJob(getCommand, {
docid: id, doc: doc,
options: param.options, options: param.options,
callbacks: {success: param.success, error: param.error} callbacks: {success: param.success, error: param.error}
}); });
......
...@@ -175,16 +175,10 @@ var storage = function (spec, my) { ...@@ -175,16 +175,10 @@ var storage = function (spec, my) {
that.addJob = function (method, storage_spec, doc, option, success, error) { that.addJob = function (method, storage_spec, doc, option, success, error) {
var command_opt = { var command_opt = {
doc: doc,
options: option, options: option,
callbacks: {success: success, error: error} callbacks: {success: success, error: error}
}; };
if (doc) {
if (method === 'get') {
command_opt.docid = doc;
} else {
command_opt.doc = doc;
}
}
jobManager.addJob(job({ jobManager.addJob(job({
storage: priv.storage(storage_spec || {}), storage: priv.storage(storage_spec || {}),
command: priv.newCommand(method, command_opt) command: priv.newCommand(method, command_opt)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment