0

I have a number of collections stored in MongoDB. Due to historical reasons there are set of enums stored as numbers. I want to start saving enums as strings, but don't want to write migration scripts. Is it possible to tune the MongoDB C# driver that it could deserialize enums either from number or string? I want to save new items with enums as string, but don't want to change existing documents.

Sane
  • 2,334
  • 2
  • 17
  • 20
  • is it too hard to write migration scripts? by the way even if you have enum strings in database, how will you work with C#? – Lei Yang Jul 10 '17 at 07:36
  • It is not so hard - the issue is in backward compatibility. I can't stop the app to perform data migration - so there will be a downtime, which is not appropriate. – Sane Jul 10 '17 at 07:46
  • 1
    As for enums as string plz see https://stackoverflow.com/questions/6996399/storing-enums-as-strings-in-mongodb – Sane Jul 10 '17 at 07:46

0 Answers0