본문 바로가기
MongoDB/Evaluation Query Operators

[MongoDB] $regex

by 드름이 2022. 7. 1.

요약: 특정 정규식을 만족시키는 document를 모두 가져오고 싶을 때 


$regex를 사용할 때 다음 형식을 사용합니다.

{ <field>: { $regex: /pattern/, $options: '<options>' } }
{ <field>: { $regex: 'pattern', $options: '<options>' } }
{ <field>: { $regex: /pattern/<options> } }

 

사용할 수 있는 options도 정의되어 있습니다.  너무 정규식 내용이라 패스...


1. 정규식을 따로 다룬 뒤에 돌아옵시다..

 

 

 

출처:$regex — MongoDB Manual 

'MongoDB > Evaluation Query Operators' 카테고리의 다른 글

[MongoDB] $mod  (0) 2022.07.01
[MongoDB] $jsonSchema  (0) 2022.07.01
[MongoDB] $expr  (0) 2022.07.01