Commit eab60f05 authored by Romain Courteaud's avatar Romain Courteaud

remove and put now return the document ID by default

parent bd7c3188
...@@ -300,14 +300,18 @@ ...@@ -300,14 +300,18 @@
this.__storage = storage; this.__storage = storage;
} }
declareMethod(JioProxyStorage, "put", checkId); declareMethod(JioProxyStorage, "put", checkId, function (argument_list) {
return argument_list[0]._id;
});
declareMethod(JioProxyStorage, "get", checkId, function (argument_list, result) { declareMethod(JioProxyStorage, "get", checkId, function (argument_list, result) {
// XXX Drop all _ properties // XXX Drop all _ properties
// Put _id properties to the result // Put _id properties to the result
result._id = argument_list[0]._id; result._id = argument_list[0]._id;
return result; return result;
}); });
declareMethod(JioProxyStorage, "remove", checkId); declareMethod(JioProxyStorage, "remove", checkId, function (argument_list) {
return argument_list[0]._id;
});
// listeners // listeners
declareMethod(JioProxyStorage, "post", function (param, storage, method_name) { declareMethod(JioProxyStorage, "post", function (param, storage, method_name) {
......
...@@ -471,7 +471,7 @@ ...@@ -471,7 +471,7 @@
jio.remove({"_id": "bar"}) jio.remove({"_id": "bar"})
.then(function (result) { .then(function (result) {
equal(result, "Removed"); equal(result, "bar");
equal(call_count, 2); equal(call_count, 2);
}) })
.fail(function (error) { .fail(function (error) {
...@@ -516,7 +516,7 @@ ...@@ -516,7 +516,7 @@
jio.remove({"_id": "bar"}) jio.remove({"_id": "bar"})
.then(function (result) { .then(function (result) {
equal(result, "Removed document"); equal(result, "bar");
equal(call_count, 2); equal(call_count, 2);
}) })
.fail(function (error) { .fail(function (error) {
......
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