| 1 |
{ |
| 2 |
"description": "Regular Expression type", |
| 3 |
"bson_type": "0x0B", |
| 4 |
"test_key": "a", |
| 5 |
"valid": [ |
| 6 |
{ |
| 7 |
"description": "empty regex with no options", |
| 8 |
"canonical_bson": "0A0000000B6100000000", |
| 9 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"\", \"options\" : \"\"}}}" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"description": "regex without options", |
| 13 |
"canonical_bson": "0D0000000B6100616263000000", |
| 14 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"\"}}}" |
| 15 |
}, |
| 16 |
{ |
| 17 |
"description": "regex with options", |
| 18 |
"canonical_bson": "0F0000000B610061626300696D0000", |
| 19 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"description": "regex with options (keys reversed)", |
| 23 |
"canonical_bson": "0F0000000B610061626300696D0000", |
| 24 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}", |
| 25 |
"degenerate_extjson": "{\"a\" : {\"$regularExpression\" : {\"options\" : \"im\", \"pattern\": \"abc\"}}}" |
| 26 |
}, |
| 27 |
{ |
| 28 |
"description": "regex with slash", |
| 29 |
"canonical_bson": "110000000B610061622F636400696D0000", |
| 30 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab/cd\", \"options\" : \"im\"}}}" |
| 31 |
}, |
| 32 |
{ |
| 33 |
"description": "flags not alphabetized", |
| 34 |
"degenerate_bson": "100000000B6100616263006D69780000", |
| 35 |
"canonical_bson": "100000000B610061626300696D780000", |
| 36 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"imx\"}}}", |
| 37 |
"degenerate_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"mix\"}}}" |
| 38 |
}, |
| 39 |
{ |
| 40 |
"description" : "Required escapes", |
| 41 |
"canonical_bson" : "100000000B610061625C226162000000", |
| 42 |
"canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab\\\\\\\"ab\", \"options\" : \"\"}}}" |
| 43 |
}, |
| 44 |
{ |
| 45 |
"description" : "Regular expression as value of $regex query operator", |
| 46 |
"canonical_bson" : "180000000B247265676578007061747465726E0069780000", |
| 47 |
"canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"ix\"}}}" |
| 48 |
}, |
| 49 |
{ |
| 50 |
"description" : "Regular expression as value of $regex query operator with $options", |
| 51 |
"canonical_bson" : "270000000B247265676578007061747465726E000002246F7074696F6E73000300000069780000", |
| 52 |
"canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"\"}}, \"$options\" : \"ix\"}" |
| 53 |
} |
| 54 |
], |
| 55 |
"decodeErrors": [ |
| 56 |
{ |
| 57 |
"description": "Null byte in pattern string", |
| 58 |
"bson": "0F0000000B610061006300696D0000" |
| 59 |
}, |
| 60 |
{ |
| 61 |
"description": "Null byte in flags string", |
| 62 |
"bson": "100000000B61006162630069006D0000" |
| 63 |
} |
| 64 |
] |
| 65 |
} |