我有一个非常基本的问题,
相当于Pymongo的
select name, surname, CONCAT(name, surname)
from db
答案 0 :(得分:0)
将mongo db集合添加到db对象。它有效
concat_results = db.aggregate(
[
{ "$project": { "NewFieldName": { "$concat": [ "$name", "$surname" ] } ,"name":True,"name":surname} }
]
);
for concat_result in concat_results:
print("name":concat_result["name"],"surname":concat_result["name"],"NewFieldName":concat_result["NewFieldName"])