1
votes

I write a big aggregate query for mongodb, now I try to translate it in Spring Data Mongodb API, and it's very complicated, and spring data api did not help me a lot.

So like with @Query annotation, is it possible to just specify my raw aggregate query in text and map my field with Spring Data (or just Mongodb Java driver) ?

I won't c/p my aggregate request because, it's not the purpose of my question.

1

1 Answers

2
votes

I found a solution by using MongoDB java driver, which is available through Spring Data :

DBCollection collection = mongoTemplate.getCollection("myCollection");

and I used BasicDBObject from this solution : MongoDB aggregation with Java driver