#required fields
1 messages · Page 1 of 1 (latest)
I noticed this a bit back (08 maybe?) felt like it was pretty firmly in the "play stupid games win stupid prizes" category of 'unintended but not really a bug.'
That's my gut feeling too, it's not something a sane person should do, but it also isn't necessarily wrong either.
The better question is if by doing so one can break core dialogs trying to open or anything like that. If so, that would be a bug
Well, there is an argument to be made for just preventing updates to documents that put them in a state where they don’t pass validation anymore…
document.update({"-=_id": null}) should certainly be illegal. No sane person would ever do that willingly, but I'm not sure if you how you would recover from executing that
Yeah, multiple ways to go
I don’t think you can (aside from manually foxing it in the db file), because there is no way to address the document anymore.
I just noticed that, if I delete a required property, it's undefined, but when I reload, it's set to the default value
Makes sense, that's basically what I expected it to do, realistically speaking
Interesting… I would probably consider that a bug…
If it’s reset in the database, the same should be happening for the in memory document
My guess is that what's happening is that re-loading the page is re-initializing the documents from database. And when that happens, when it builds the objects in memory, it populates the required fields with defaults
definitely not intended, but we clearly don't have certain checks in place to prevent you shooting yourself in the foot (head?)
In terms of what we might do differently, I would want to focus specifically on the V10 behavior here, since this overlaps a lot with the data model and data fields changes