1
0
Fork 0

issue #1104: edgeExamples broken or changed

This commit is contained in:
Jan Steemann 2014-11-18 10:29:10 +01:00
parent 8f3779b1eb
commit 2b92cf5edd
1 changed files with 13 additions and 12 deletions

View File

@ -4655,24 +4655,22 @@ function FILTER_RESTRICTION (list, restrictionList) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
function DOCUMENTS_BY_EXAMPLE (collectionList, example) { function DOCUMENTS_BY_EXAMPLE (collectionList, example) {
var res = []; var res = [ ];
if (example === "null") { if (example === "null" || example === null || ! example) {
example = [{}]; example = [ { } ];
}
if (!example) {
example = [{}];
} }
if (typeof example === "string") { if (typeof example === "string") {
example = {_id : example}; example = { _id : example };
} }
if (!Array.isArray(example)) { if (! Array.isArray(example)) {
example = [example]; example = [ example ];
} }
var tmp = []; var tmp = [ ];
example.forEach(function (e) { example.forEach(function (e) {
if (typeof e === "string") { if (typeof e === "string") {
tmp.push({_id : e}); tmp.push({ _id : e });
} else { }
else {
tmp.push(e); tmp.push(e);
} }
}); });
@ -5219,6 +5217,9 @@ function CALCULATE_SHORTEST_PATHES_WITH_DIJKSTRA (graphName, options) {
params.paths = true; params.paths = true;
if (options.edgeExamples) { if (options.edgeExamples) {
params.followEdges = options.edgeExamples; params.followEdges = options.edgeExamples;
if (! Array.isArray(params.followEdges)) {
params.followEdges = [ params.followEdges ];
}
} }
if (options.edgeCollectionRestriction) { if (options.edgeCollectionRestriction) {
params.edgeCollectionRestriction = options.edgeCollectionRestriction; params.edgeCollectionRestriction = options.edgeCollectionRestriction;