如何在SpringBoot的mongoDB中构造与$$ROOT合并的对象?

如何在SpringBoot的mongoDB中构造与$$ROOT合并的对象?,mongodb,spring-boot,Mongodb,Spring Boot,我用SpringBoot操作mongoDB。我遇到的问题如下: 当使用$mergeObjects操作符时,我想合并两个对象,范围从一个人工对象到$$ROOT,即下面的代码段。我想知道如何在SpringBoot中编写用户定义的对象 $mergeObjects: [ { "propertyA":"$xx.xx", "propertyB":"$xxx.xxx"

我用SpringBoot操作mongoDB。我遇到的问题如下: 当使用$mergeObjects操作符时,我想合并两个对象,范围从一个人工对象到$$ROOT,即下面的代码段。我想知道如何在SpringBoot中编写用户定义的对象

$mergeObjects: [
        {
            "propertyA":"$xx.xx",
            "propertyB":"$xxx.xxx",
            "propertyC":"$xxxx.xxxx"
        }, "$$ROOT"]

我找到了解决办法。这很容易。hashMap可能会有所帮助