Select records matching concat value of two fields in mongodb
问题 Is there a way to do something like this on MongoDB? select * from table where concat(field1, field2) = 'value' To clarify, I have an array of full names, but the documents have firstname and lastname separate, so I want to do something like select * from table where concat(firstname, lastname) in ([ARRAY OF NAMES]) 回答1: You can only do it with aggregation framework, not with regular find. db.coll.aggregate({$project:{newField:{$concat:["$field1","$field2"]}}}, {$match:{newField:"value"}} );