blob: 0a8b3e0859323f99dd86a6cbf926b1fe9a09ebf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var t = db.regex_limit;
t.drop();
var repeatStr = function(str, n) {
return new Array(n + 1).join(str);
};
t.insert({z: repeatStr('c', 100000)});
var maxOkStrLen = repeatStr('c', 32764);
var strTooLong = maxOkStrLen + 'c';
assert(t.findOne({z: {$regex: maxOkStrLen}}) != null);
assert.throws(function() {
t.findOne({z: {$regex: strTooLong}});
});
assert(t.findOne({z: {$in: [new RegExp(maxOkStrLen)]}}) != null);
assert.throws(function() {
t.findOne({z: {$in: [new RegExp(strTooLong)]}});
});
|