neulab / explainaboard_web

MIT License
8 stars 2 forks source link

pre-generate id for system creation #552

Closed lyuyangh closed 1 year ago

lyuyangh commented 1 year ago

We have been using MongoDB's mechanism to generate system IDs on insert. This is not ideal because it requires us to execute operations in a certain order (e.g. we don't know the system ID until it is actually created in the DB). We also had to use None as a hacky placeholder for system_id before the record is inserted into the DB (it is also not type-correct). This is error-prone because if the developer doesn't know this context, they may access system_id before it holds the actual value.

This PR fixes this issue by pre-generating the id for the system so system_id is always accessible.