Commit 9cee6eb7 authored by Vincent Bechu's avatar Vincent Bechu

mappingstorage: change equalSubId comportement

parent 7d9e1704
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
function getSubIdEqualSubProperty(storage, value, key) { function getSubIdEqualSubProperty(storage, value, key) {
var query; var query;
if (storage._no_sub_query_id) {
throw new jIO.util.jIOError('no sub query id active', 404);
}
query = new SimpleQuery({ query = new SimpleQuery({
key: key, key: key,
value: value, value: value,
...@@ -88,11 +91,16 @@ ...@@ -88,11 +91,16 @@
} }
}, },
"equalSubId": { "equalSubId": {
"mapToSubProperty": function () { "mapToSubProperty": function (property, sub_doc, doc) {
return false; sub_doc[property] = doc[property];
return property;
}, },
"mapToMainProperty": function (property, sub_doc, doc, args, sub_id) { "mapToMainProperty": function (property, sub_doc, doc, args, sub_id) {
doc[property] = sub_id; if (sub_id === undefined && sub_doc.hasOwnProperty(property)) {
doc[property] = sub_doc[property];
} else {
doc[property] = sub_id;
}
return property; return property;
}, },
"mapToSubId": function (storage, doc, id, args) { "mapToSubId": function (storage, doc, id, args) {
...@@ -161,6 +169,7 @@ ...@@ -161,6 +169,7 @@
this._sub_storage = jIO.createJIO(spec.sub_storage); this._sub_storage = jIO.createJIO(spec.sub_storage);
this._map_all_property = spec.map_all_property !== undefined ? this._map_all_property = spec.map_all_property !== undefined ?
spec.map_all_property : true; spec.map_all_property : true;
this._no_sub_query_id = spec.no_sub_query_id;
this._attachment_mapping_dict = spec.attachment || {}; this._attachment_mapping_dict = spec.attachment || {};
this._query = spec.query || {}; this._query = spec.query || {};
this._map_id = spec.id || ["equalSubId"]; this._map_id = spec.id || ["equalSubId"];
......
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