1
0
Fork 0
This commit is contained in:
jsteemann 2016-06-16 00:07:34 +02:00
parent 289a25bf5f
commit 5af79e0daf
1 changed files with 4 additions and 4 deletions

View File

@ -278,7 +278,7 @@ var buildEdgeCollectionRestriction = function(collections) {
collections = [ collections ];
}
return collections.map(collection => "`" + collection + "`").join(",");
}
};
var buildVertexCollectionRestriction = function(collections, varname) {
if (!Array.isArray(collections)) {
@ -290,7 +290,7 @@ var buildVertexCollectionRestriction = function(collections, varname) {
}).join(" OR ")}
)`;
return `${filter}`;
}
};
var buildFilter = function(examples, bindVars, varname) {
var varcount = 0;
@ -1204,7 +1204,7 @@ Graph.prototype._edges = function(vertexExample, options) {
${Array.isArray(options.edgeCollectionRestriction) && options.edgeCollectionRestriction.length > 0 ? buildEdgeCollectionRestriction(options.edgeCollectionRestriction) : "GRAPH @graphName"}
${buildFilter(options.edgeExamples, bindVars, "e")}
RETURN DISTINCT ${options.includeData === true ? "e" : "e._id"}`;
if(!Array.isArray(options.edgeCollectionRestriction) || options.edgeCollectionRestriction.length == 0) {
if(!Array.isArray(options.edgeCollectionRestriction) || options.edgeCollectionRestriction.length === 0) {
bindVars.graphName = this.__name;
}
return db._query(query, bindVars).toArray();
@ -1324,7 +1324,7 @@ Graph.prototype._neighbors = function(vertexExample, options) {
${buildFilter(options.edgeExamples, bindVars, "e")}
${Array.isArray(options.vertexCollectionRestriction) && options.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(options.vertexCollectionRestriction,"v") : ""}
RETURN DISTINCT ${options.includeData === true ? "v" : "v._id"}`;
if(!Array.isArray(options.edgeCollectionRestriction) || options.edgeCollectionRestriction.length == 0) {
if(!Array.isArray(options.edgeCollectionRestriction) || options.edgeCollectionRestriction.length === 0) {
bindVars.graphName = this.__name;
}
return db._query(query, bindVars).toArray();