How to merge multiple fields in a collection?
问题 Example entry: { "_id" : "00-01@mail.ru", " pass" : 123654, "field2" : 235689, "field3" : "cccp123654", "field4" : "lhfrjy" } Desired result: { "_id" : "00-01@mail.ru", " pass" : 123654, 235689, "cccp123654", "lhfrjy" } I want to have two final fields (_id and pass). I have attempted the following: db.emails.aggregate([ { "$project": { "pass": { "$setUnion": [ "$field2", "$field3" ] } }} ]) However, this results in the following error: 2018-01-22T03:01:26.074+0000 E QUERY [thread1] Error: