Add a notion of transaction?
the pkm-api insertion and update scripts tend to perform several database operations (insertions/deletions/updates). Thus, if something goes wrong in the middle of the script, the database may be left in an incoherent state. Normally, doing an update again should take care of that, but it might be good to add a notion of transition at some point.
Note however that transitions seems to have appeared only in MongoDB 4.0