Thank you very much for your quick response
I am very new to MongoDB. I have used POJO to store in the database. Since the document model is a nested one and that there could be thousands list items in the child array field I have a question: wouldn’t it be very slow to use ObjectMapper to convert Document to POJO ? It would also slow down the process to read the stored result from the resource file?
My intention is to build on this block of java code to make the query more efficient(to use unwind and reduce):
Bson match = Aggregates.match(
Bson sort = Aggregates.sort(
Bson group = Aggregates.group(
List<Data> dataList = dataMongoCollection.aggregate(
But I found out that it’s quite slow to run the Java query. Is there anyway to improve my existing Java query ? How can I skip sort but still get the document with highest value of time for a certain region._id ?
Thank you very much in advance