OrleansContrib / Orleans.Providers.MongoDB

A MongoDb implementation of the Orleans Providers: Membership, Storage and Reminders.
MIT License
105 stars 44 forks source link

Modify the DataTime type' storage format from String to Date Type in MongoDB #48

Closed sdghchj closed 6 years ago

sdghchj commented 6 years ago

it's more convenient for MongoDB driver to query by date.

SebastianStehle commented 6 years ago

It needs to be configurable, otherwise it would break the compatibility.

sdghchj commented 6 years ago

yeah, but DateTime value's old format in MongoDB is String. When deserializing it to DataTime member in a grain state, the following line is run: case BsonType.String: , not the following line: case BsonType.DateTime:

When WriteStateAsync method is called next time after my modification, the DateTime member will be update to MongoDB date type by running the following line: case JTokenType.Date:

That is, the old line 'case BsonType.DateTime' for deserilizing has never been run actually. So I don't think my modification breaks the compatibility, of course, expect that the old MongoDB data is also used by some other integrated systems.

sdghchj commented 6 years ago

Re-check please. I have made it configurable .