0

I use the method render of UpdateDefinition to get BsonDocument with this code :

var updateBsonDocument = updateDefinition.Render(BsonSerializer.LookupSerializer<TDocument>(), BsonSerializer.SerializerRegistry);

When I call this method, The DateTime properties of my object in UpdateDefinition are serialized in BsonDocument with dates with UTC value.

How I can prevent this behavior ?

binard
  • 1,726
  • 1
  • 17
  • 27

1 Answers1

1

That is the default behavior MongoDB, dates are always stored as UTC. According to their documentation, there's no way around this, other then you storing additional data that you will need to use yourself to get the original value back.

https://docs.mongodb.org/manual/tutorial/model-time-data/

Steen Tøttrup
  • 3,755
  • 2
  • 22
  • 36