Closed surajthomask closed 1 year ago
Hey @surajthomask,
Is your date stored as a Double in the database?
If you need me urgently in the future, please reach out through our discord server. There are a lot of github emails that pass through my mailbox daily.
Hi @Joannis, Thanks for the response. As of 8.0.1, the framework was storing the date as double in the server on it's own. As far as I can see there were no custom handling of data type other than specifying the variable type to be Double in the model. When we updated the dependencies to 8.0.6, it started throwing this error.
We were trying to update the Vapor dependencies in our project, and encountered an issue with conversion of timestamp in MongoDB to Date objects. Version 8.0.1 works just fine, but updating to 8.0.6 breaks the decoding and throws the following error.
{"reason":"BSONTypeConversionError<Optional<Primitive>>(from: Optional(695638132.716054), to: Foundation.Date)"}
An example model is given below;
v8.0.1 allows data insertion as well as retrieval without any issue. v8.0.6 breaks the data retrieval from the DB.
Would appreciate a quick look into this.