I am using spring data with mongodb
. The problem is that the entity contains a date field which we receive data for from a MS SQL database in UTC timezone by default. Example date is below.
2017-12-06 14:50:17.630
When we store the entity into mongodb it actually substracts 5:30 hrs from the date and then stores it in ISO format for example above date would be stored like
"submittedDate" : ISODate("2017-12-06T09:20:17.630Z"),
My entity is something like below:
public class LegalEntity {
private String name;
private Date updateDate;
}
To me it seems Mongo is by default considering that the dates are coming in IST and hence it converts these to UTC and then stores and returns the same in UTC as well.
Is there anyway to tell mongo that the date is coming in UTC by default and don't convert it?