이 버전의 문서는 보관되어 더 이상 지원되지 않습니다. 6.0 배포서버 업그레이드 하려면 MongoDB 7.0 업그레이드 절차를 참조하세요.
정의
행동
$toLower 는 ASCII 문자의 문자열에 대해서만 잘 정의된 동작을 보유합니다.
예시
다음 문서가 포함된 inventory collection을 생각해 보세요.
db.inventory.insertMany( [    { _id: 1, item: "ABC1", quarter: "13Q1", description: "PRODUCT 1" },    { _id: 2, item: "abc2", quarter: "13Q4", description: "Product 2" },    { _id: 3, item: "xyz1", quarter: "14Q2", description: null } ] ) 
다음 연산은 $toLower 연산자를 사용하여 item, description 값을 소문자로 반환합니다.
db.inventory.aggregate(    [      {        $project:          {            item: { $toLower: "$item" },            description: { $toLower: "$description" }          }      }    ] ) 
이 연산은 다음과 같은 결과를 반환합니다.
{ _id: 1, item: "abc1", description: "product 1" } { _id: 2, item: "abc2", description: "product 2" } { _id: 3, item: "xyz1", description: "" }