Commit 4590a3a1 authored by Aurel's avatar Aurel

Merge remote-tracking branch 'vincentB/mappingstorage' into nodejs-romain

Conflicts:
	src/jio.storage/mappingstorage.js
	test/jio.storage/mappingstorage.tests.js
parents e724e037 2af26640
...@@ -334,12 +334,22 @@ ...@@ -334,12 +334,22 @@
this, this,
doc doc
), ),
id = doc[this._property_for_sub_id]; id = doc[this._property_for_sub_id],
storage = this;
if (this._property_for_sub_id && id !== undefined) { if (this._property_for_sub_id && id !== undefined) {
return this._sub_storage.put(id, sub_doc); return this._sub_storage.put(id, sub_doc);
} }
if (!this._id_mapped || doc[this._id_mapped] !== undefined) { if (!this._id_mapped || doc[this._id_mapped] !== undefined) {
return this._sub_storage.post(sub_doc); return getSubStorageId(storage, id, doc)
.push(function (sub_id) {
return storage._sub_storage.put(sub_id, sub_doc);
})
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError) {
return storage._sub_storage.post(sub_doc);
}
throw error;
});
} }
throw new jIO.util.jIOError( throw new jIO.util.jIOError(
"post is not supported with id mapped", "post is not supported with id mapped",
......
...@@ -1181,7 +1181,7 @@ ...@@ -1181,7 +1181,7 @@
"smth": "bar" "smth": "bar"
}) })
.push(function () { .push(function () {
jio.put( return jio.put(
"2713", "2713",
{ {
"title": "bar", "title": "bar",
......
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