Pymongo merges a collection (table) into another collection

there are currently three collections user consume recharge
just want to completely modify the User collection instead of creating a temporary collection like lookup, is there any efficient way, after all, there is a lot of data.
currently used $replaceRoot $mergeObjects method can be implemented, but the speed is too slow and the CPU occupancy rate is extremely high

.
user = db.get_db_user()
recharge = db.get_db_recharge()
consume = db.get_db_consume()


lookup1 = {"$lookup": {
        "from": "recharge",
        "localField": "_id",
        "foreignField": "uid",
        "as": "recharge"
}}
lookup2 = {"$lookup": {
        "from": "consume",
        "localField": "_id",
        "foreignField": "uid",
        "as": "consume"
}}
replaceRoot1 = {"$replaceRoot": {"newRoot": {"$mergeObjects": [{"$arrayElemAt": ["$recharge", 0]}, "$$ROOT"]}}}
replaceRoot2 = {"$replaceRoot": {"newRoot": {"$mergeObjects": [{"$arrayElemAt": ["$consume", 0]}, "$$ROOT"]}}}
pipeline = [lookup1, lookup2, replaceRoot1, replaceRoot2]
result = user.aggregate(pipeline)
num = 0
for i in result:
    num = num + 1
    pprint.pprint(i)
print(num)
May.06,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e493ff-44d31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e493ff-44d31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?