mirror of https://gitee.com/bigwinds/arangodb
Allow specifying "_" as collection prefix.
This commit is contained in:
parent
6a89d78929
commit
288c6d8d31
|
@ -192,14 +192,13 @@ function extendContext (context, app, root) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var cp = context.collectionPrefix;
|
var cp = context.collectionPrefix;
|
||||||
var cname = "";
|
|
||||||
|
|
||||||
if (cp !== "") {
|
if (cp !== "" && cp !== "_") {
|
||||||
cname = cp + "_";
|
cp += "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
context.collectionName = function (name) {
|
context.collectionName = function (name) {
|
||||||
var replaced = (cname + name).replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '').substr(0, 64);
|
var replaced = (cp + name.replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '')).substr(0, 64);
|
||||||
|
|
||||||
if (replaced.length === 0) {
|
if (replaced.length === 0) {
|
||||||
throw new Error("Cannot derive collection name from '" + name + "'");
|
throw new Error("Cannot derive collection name from '" + name + "'");
|
||||||
|
|
Loading…
Reference in New Issue