If I have an existing table in a NoSQL database cluster and I want to add a new column that should never return null, how do I handle it in my application code?

  • I can update all exist records and set that new column to some default value (if there is a sensible default).
  • I can have my application code assume a default value if it reads a records with no value for the field
  • ???

The problem I see with the first solution is that there may be existing code that writes records without the mandatory column leaving the table with "broken" records. The second solution may "mask" existing code that fails to write the new column value.

How do people handle this scenario?

  • How about populating existing records, and then running a daily exception report for data without the new value? It should help you pin down any apps which are creating records. – Jon of All Trades Nov 22 '13 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.