|
|
@@ -33,7 +33,7 @@ var errors = require("../../Errors.js"),
|
|
|
AtomicMatchExpression = require("./AtomicMatchExpression.js");
|
|
|
|
|
|
// The maximum allowed depth of a query tree. Just to guard against stack overflow.
|
|
|
-var kMaximumTreeDepth = 100;
|
|
|
+var MAXIMUM_TREE_DEPTH = 100;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -87,9 +87,9 @@ proto._isDBRefDocument = function _isDBRefDocument(obj, allowIncompleteDBRef) {
|
|
|
*
|
|
|
*/
|
|
|
proto._parse = function _parse(obj, level){
|
|
|
- if (level > kMaximumTreeDepth)
|
|
|
+ if (level > MAXIMUM_TREE_DEPTH)
|
|
|
return {code:ErrorCodes.BAD_VALUE, description:"exceeded maximum query tree depth of " +
|
|
|
- kMaximumTreeDepth + " at " + obj};
|
|
|
+ MAXIMUM_TREE_DEPTH + " at " + obj};
|
|
|
|
|
|
var rest, temp, status, element, eq, real;
|
|
|
var root = new AndMatchExpression();
|
|
|
@@ -279,7 +279,7 @@ proto._parseArrayFilterEntries = function _parseArrayFilterEntries(entries, theA
|
|
|
e = theArray[i];
|
|
|
|
|
|
if (this._isExpressionDocument(e, false)) {
|
|
|
- return {code:ErrorCodes.BadValue, description:"cannot nest $ under $in"};
|
|
|
+ return {code:ErrorCodes.BAD_VALUE, description:"cannot nest $ under $in"};
|
|
|
}
|
|
|
|
|
|
if (e instanceof RegExp ) {
|
|
|
@@ -561,9 +561,9 @@ proto._parseSub = function _parseSub(name, sub, root, level){
|
|
|
var subkeys = Object.keys(sub),
|
|
|
currname, currval;
|
|
|
|
|
|
- if (level > kMaximumTreeDepth) {
|
|
|
- return {code:ErrorCodes.BadValue, description:"exceeded maximum query tree depth of " +
|
|
|
- kMaximumTreeDepth + " at " + sub};
|
|
|
+ if (level > MAXIMUM_TREE_DEPTH) {
|
|
|
+ return {code:ErrorCodes.BAD_VALUE, description:"exceeded maximum query tree depth of " +
|
|
|
+ MAXIMUM_TREE_DEPTH + " at " + sub};
|
|
|
}
|
|
|
|
|
|
level++;
|
|
|
@@ -622,7 +622,7 @@ proto._parseSubField = function _parseSubField(context, andSoFar, name, element,
|
|
|
// Just because $ne can be rewritten as the negation of an
|
|
|
// equality does not mean that $ne of a regex is allowed. See SERVER-1705.
|
|
|
if (currval instanceof RegExp) {
|
|
|
- return {code:ErrorCodes.BadValue, description:"Can't have regex as arg to $ne."};
|
|
|
+ return {code:ErrorCodes.BAD_VALUE, description:"Can't have regex as arg to $ne."};
|
|
|
}
|
|
|
status = this._parseComparison(name, 'EQ', currval);
|
|
|
if (status.code != ErrorCodes.OK)
|