forbidden() : MongoRegexPolicy[maxLength=1, allowedFlags=[], requireAnchored=true] standard() : MongoRegexPolicy[maxLength=64, allowedFlags=[i], requireAnchored=true] 길이 0 정책 : IllegalArgumentException: a regex policy needs a positive maximum length [검증] 금지 정책이 받는 조합과 막는 조합 ("^", "") -> 수용 ("^", "i") -> 거절, regex flag 'i' is not allowed by this collection's policy ("", "") -> 거절, the pattern is not anchored at the start, so it cannot use an index and will scan the collection ("a", "") -> 거절, the pattern is not anchored at the start, so it cannot use an index and will scan the collection ("^a", "") -> 거절, the pattern is 2 characters, above the limit of 1 ("^\Q\E", "") -> 거절, the pattern is 5 characters, above the limit of 1 ("\Q\E", "") -> 거절, the pattern is 4 characters, above the limit of 1 [도우미] 길이 검사를 얹은 인스턴스 메서드는 입력과 무관하게 던진다 literalPrefix("") = ^\Q\E (5자) prefixPattern("") -> 거절, the pattern is 5 characters, above the limit of 1 literalPrefix("ab") = ^\Qab\E (7자) prefixPattern("ab") -> 거절, the pattern is 7 characters, above the limit of 1 escapedContains("") = \Q\E (4자) [전제] 기본 연산자 집합에 REGEX 가 있는가 : false [GT, GTE, LT, IN, EQ, LTE, EXISTS] [조립] whereMatches("name", "^", "") 가 만든 질의 {"$and": [{"name": {"$regularExpression": {"pattern": "^", "options": ""}}}]} [실행] 저장 8건 · 매치 4건 매치 {"name": "ana"} 매치 {"name": ""} 매치 {"name": "\ud83d\ude00"} 매치 {"name": ["zz"]} 미매치 {"name": 12345} 미매치 {"name": true} 미매치 {"name": null} 미매치 {"other": "x"}