Я ищу переводчика, чтобы изменить это:
getCollection('migrate').aggregate([
{ "$project": {
"Contrat": {"Field1":"$Field1", "Field2":"$Field2"},
"Formule": {"Field3":"$Field3", "Field4":"$Field4"}
}},
{ "$project": {
"Contrats": {"Contrat":"$Contrat", "Formule":"$Formule"}
}}
])
к структуре агрегации MongoJava. Что-то вроде:
AggregationOperation project = Aggregation.project("Field1,Field2"); // while naming it "Contrat"
AggregationOperation project2 = Aggregation.project("Field3,Fiel4"); // while naming it Formule
AggregationOperation project3 = Aggregation.project("Contrat,Formule"); // while naming it " Contrats"
AggregationOperation out = Aggregation.out("test");
Aggregation aggregation = Aggregation.newAggregation(project, project2, project3, out);
mongoTemplate.aggregate(aggregation, "<nameOfInitialCollection>", Class.class);
Я не могу найти свои ответы в документации, которая мне кажется слишком скудной, или я могу быть слишком затерян в ней (| тупой).
Заранее благодарю.