Mongo and BSON Date types store time with millisecond precision. Java's java.util.Date class does too. However, com.mongodb.util.JSON.serialize() outputs Date strings without milliseconds using SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") and com.mongodb.util.JSON.parse() does not accept date strings containing milliseconds.
This leads to
Date date = new Date();
Date truncated = (Date) JSON.parse(JSON.serialize(date));
System.out.println("Dates are equal? " + date.equals(truncated));
to print "Dates are equal? false"
Date format should instead be SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").
Currently, JSON.parse() does not accept time strings that include milliseconds, returning null instead of a Date object. It should accept strings with milliseconds, and maintain backwards compatibility (for people who have stored JSON strings somewhere) by continuing to accept strings without milliseconds.