我有一种情况,我将以json字符串形式接收最终的汇总查询。我正在使用java spring mongo模板来处理查询。
mongoTemplate.executeCommand(query2);
其中query2是带有聚合命令的数组字符串,如果我在robomongo中执行查询,则可以正常运行,但是当我使用executecommand时,它将失败
query2 = db.exposedDocument.aggregate([{"$match":{"_id":"2520145607210090570"}},{"$lookup":{"localField":"details.asset.info.relatedAssetEntity.uId","as":"relatedAsset","foreignField":"_id","from":"exposedDocument"}},{"$project":{"assetDetails":"$details","assetId":"$_id","_id":0}},{"$project":{"assetDetails.activity":1,"assetDetails.asset.asset.details.circuitDetails.circuitId":1,"assetDetails.ticket":1,"assetDetails.asset.asset.details.accessInterconnect":1,"assetId":1,"assetDetails.asset.asset.details.serviceType":1,"assetDetails.asset.asset.details.accessSpeed":1,"assetDetails.asset.asset.details.deviceId":1,"assetDetails.alarm":1}}])
execute命令是否能够处理此查询?