How to overwrite the old value of the field with NULL in RavenDB?

Tag: null , ravendb Author: ttzqdr Date: 2013-01-14

I have a document stored in RavenDB that has a property which was saved with some non-null value, say 2. I want to update that value to NULL and save it. When I do that, it retains the previous value of 2 instead of changing it to NULL. How can I make RavenDB store NULL instead of the old value?

Show your code please. My guess is that you didn't call SaveChanges() - but no way to tell unless you post it! :)

Best Answer

This should work. If you go to the Studio and change the JSON itself and this still happens, that is probably a bug and you should report it.

comments:

I was mistaken. Upon further research I found out that the issue is related to AutoMapper, it's not RavenDB that won't overwrite previous values with NULLs, it's AM's doing. Sorry about that.