Underdstand why time comes as epoch and timestamp after mongo java driver upgrade

When I query mongo this is how my field looks like

“cat” : ISODate(“2024-08-25T07:02:00.312Z”)

after using the mongo java driver 5.1.0 I get this as

“cat”: {“$date”: “2024-08-25T07:02:00.312Z”}}

but all the other fields come as

“cat”: {“$date”: 1580457720558}}

Why do i get the time in different formats ? When I look at mongo they all follow the same format - ISODate(“2024-08-25T07:02:00.312Z”)

Current Mongo Version - 4.2
old mongo java driver version which has no issues - 3.12
new mongo java driver which has issues - 5.1.0