Mongodb $replaceRoot

found mergeObjects and replaceRoot aggregation methods

in order to merge collections.

examples of official documents are copied down and modified and found that there are no errors available, but there are a few areas that I do not understand. Please refer to you

.

related codes

replaceRoot1 = {"$replaceRoot": {"newRoot": {"$mergeObjects": [{"$arrayElemAt": ["$recharge", 0]}, "$$ROOT"]}}}
replaceRoot2 = {"$replaceRoot": {"newRoot": {"$mergeObjects": [{"$arrayElemAt": ["$consume", 0]}, "$$ROOT"]}}}
-sharp replaceRoot 
-sharp mergeObjects 
-sharp arrayElemAt 
What is the format of

$replaceRoot , and what do newRoot and $ROOT mean?

May.10,2021

check the document:

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-1b348ea-2bf18.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-1b348ea-2bf18.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?