0
MongoCollection<Document> Person_List = db.getCollection("Person");
MongoCollection<Document> active_list = db.getCollection("activelist"); 
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-DD"); 
String todaydate = format.format(new Date()); 
ArrayList<Document> 
activeList=Person_List.find(Filters.regex("LastUpdate",todayDate.toString())).into(new 
ArrayList<Document>());

This is the code what we have written, here we need to fetch the month from todaydate and need to compare with month of LastUpdate field, how to fetch the month from LastUpdate document field in mongo db, LastUpdate is the date string, can someone please help me.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.