Articles → MONGODB → $Concat Aggregation Operator In Mongodb$Concat Aggregation Operator In MongodbIn this article, we will discuss the $concat aggregation operator in MongoDB.Purpose The $concat operator concatenates the strings and returns the concatenated string.Example Consider the following collection: -We are required to concatenate the firstname and lastname field. So, the query would be: -db.Employees.aggregate([ { $project: { fullName: { $concat: ["$firstname", " ", "$lastname"] } } } ])Output Posted By - Karan Gupta Posted On - Monday, June 3, 2024 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.Employees.aggregate([ { $project: { fullName: { $concat: ["$firstname", " ", "$lastname"] } } } ])
Query/Feedback