SyntaxFix
Write A Post
Hire A Developer
Questions
This query will give both field value and length:
db.usercollection.aggregate([ { $project: { "name": 1, "length": { $strLenCP: "$name" } }} ])