Open timgraham opened 4 weeks ago
I'm willing to take a group vote here, but here's my take:
Questions:
if adding a field with a default, Django will populate the default value on existing rows. Should MongoDB do it?
Yes
If so, what about if there's no value to be populated? Should the field not be added to existing documents?
The field SHOULD be added to reduce bug issues; this is a point I am willing to discuss
My larger sentiment is let's keep to how Django handles SQL backends generally to reduce any potential errors that could arise from assumptions made elsewhere in the code.
Considerations :
Undefined
in JavaScript would need to be there. I think this is cumbersome and ultimately increases complexity in a system that didn't have this before. Ergo, it's more trouble that its' worth in an MVP iteration.
Should these operations try to follow what Django does on SQL backends as much as possible?
For example, if adding a field with a default, Django will populate the default value on existing rows. Should MongoDB do it? If so, what about if there's no value to be populated? Should the field not be added to existing documents? We might be able to do that for nullable fields, but perhaps not for string-based fields where
null=False
and the default is an empty string.