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.