AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

필터의 정규 표현식

버전 1.6에 추가 되었습니다.

1.6부터 start API는 정규 표현식을 사용하여 필터링된 동기화에 사용되는 includeNamespacesexcludeNamespaces 매개변수에 대한 필터를 구성할 수 있도록 지원합니다.

필터링된 동기화 를 사용하도록 mongosync 의 데이터베이스 및 collection을 일치시키려면 정규 표현식을 사용할 수 있습니다.

{
"databaseRegex": {
"pattern": "<string>",
"options": "<string>"
},
"collectionsRegex": {
"pattern": "<string>",
"options": "<string>"
}
}

The regular expression pattern you pass into a filter must follow the regex syntax supported by the MongoDB server.

Regular expressions in filter documents use options listed in the regex guide. options is a string of concatenated options. For example, to specify the i and s options, pass in "si" to options. The order of concatenated options does not matter.

필터 문서의 정규 표현식은 다음 필드를 사용합니다.

옵션
유형
설명

collectionsRegex

문서

필터와 일치시킬 collection을 지정합니다.

collectionsRegex.options

문자열

일치에 사용할 정규 표현식 옵션입니다.

collectionsRegex.pattern

문자열

일치시킬 정규 표현식 패턴입니다.

databaseRegex

문서

필터를 일치시킬 데이터베이스를 지정합니다.

databaseRegex.options

문자열

일치에 사용할 정규 표현식 옵션입니다.

databaseRegex.pattern

문자열

일치시킬 정규 표현식 패턴입니다.

이러한 옵션은 includeNamespacesexcludeNamespaces 매개변수 모두와 함께 사용할 수 있습니다.

정규 표현식을 사용하면 여러 데이터베이스 또는 collection을 단일 패턴으로 일치시킬 수 있습니다. 이름이 비슷한 데이터베이스 또는 컬렉션을 여러 개 일치시키려는 경우 개별 데이터베이스 또는 컬렉션 그룹에 대한 일련의 필터를 만드는 것보다 정규 표현식이 더 쉬울 수 있습니다.

databaseRegex and collectionsRegex each supports an options field, which you can use to configure regular expression options. Internally, mongosync passes the filter and options to the $regex operator. Options available to that operator can be used with Filtred Sync.

예시 들어, 이 필터하다 accounts_ 문자열로 시작하는 sales 데이터베이스 의 컬렉션과 일치합니다. 또한 이 필터하다 여러 줄 값이 있는 문자열의 경우 각 줄의 시작 또는 끝에 있는 문자를 일치시키는 m 옵션과 s 옵션을 지정하여 점 문자가 개행 문자를 포함한 모든 문자와 일치하도록 합니다.

"includeNamespaces": [
{
"database": "sales",
"collectionsRegex": {
"pattern": "^accounts_.+?$",
"options": "ms"
}
}
]
이 페이지 평가하기