Reputation: 4734
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.
Upvotes: 1
Views: 1366
Reputation: 4734
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
Upvotes: 2