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):
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 ?
I store back the debugged pipeline, the result of the debug session. The result of running the pipeline is always process the normal way. There is no intermediary step involve to process the aggregation result.
I guess that my very limited knowledge in MongoDB makes it difficult for me to understand everything that you wrote. Do I need to remap the result to my POJO model in Java ? You see, if I use the Java query I get a list of my POJO directly.
Do you have a solution regarding my question about the query in Java ?