Join Strings in Query output

I have this query that "i'd like to convert to MongoDB. Is it possible to do this without resorting to javascript?

SELECT FirstName, Lastname, FirstName + " " + LastName AS FullName FROM Users

Also, I am using the most recent version of MongoDB

Answers


The only things that can "alter" the form of a returned document are .aggregate() and .mapReduce(). In this case, .aggregate() is the better form with $project and the $concat operator:

db.users.aggregate([
   { "$project": {
       "FirstName": 1,
       "Lastname": 1,
       "FullName": { "$concat": [ "$FirstName", " ", "$Lastname" ] }
   }}
])

Need Your Help

FIFO (named pipe) in C

c named-pipes fifo

Recently I have tasked with customizing one of the applications that our groups uses quite regularly. The application is written in C, something that I don't have a whole lot of experience in. I ...