blob: b602b8b8c527c95112cee0492c51fc962880dc9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/**
* Test that the server errors when given an invalid regex.
* @tags: [
* ]
*/
(function() {
const coll = db.regex_error;
coll.drop();
// Run some invalid regexes.
assert.commandFailedWithCode(coll.runCommand("find", {filter: {a: {$regex: "[)"}}}), 51091);
assert.commandFailedWithCode(coll.runCommand("find", {filter: {a: {$regex: "ab\0c"}}}),
ErrorCodes.BadValue);
assert.commandFailedWithCode(
coll.runCommand("find", {filter: {a: {$regex: "ab", $options: "\0i"}}}), 51108);
})();
|