Articles → MONGODB → $Substrcp Aggregation Function In Mongodb
$Substrcp Aggregation Function In Mongodb
Purpose
Syntax
{ $substrCP: [ <string>, <start>, <length> ] }
Example
db.Employees.aggregate([
{
$project: {
name: { $substrCP: ["$firstname", 0, 2] }
}
}
])
Output
Posted By - | Karan Gupta |
|
Posted On - | Monday, June 3, 2024 |