How do I concatenate values from two string fields and put it into a third one?
I\'ve tried this:
db.collection.update( { \"_id\": { $exists: true
You can use aggregation operators $project and $concat:
db.collection.aggregate([ { $project: { newfield: { $concat: [ "$field1", " - ", "$field2" ] } } } ])