Articles → MONGODB → $Strlencp Aggregation Operator In Mongodb

$Strlencp Aggregation Operator In Mongodb






Purpose







Example




Picture showing the sample document collection




db.Employees.aggregate([
    {
        $project: {
            firstname: 1,
            nameLength: { $strLenCP: "$firstname" }
        }
    }
])



Output


Picture showing the output of $strlencp aggregation operator in mongodb





Posted By  -  Karan Gupta
 
Posted On  -  Monday, June 3, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250