This PR replaces insert_one() by replace_one() with upsert policy in mongo logging. With upsert, the document in mongo will be replaced if target already exists and inserted if the document doesn't exist. I think that it is more convenient than inserting when the only thing that you want to know is the latest version number of a middleware. I also realize that insert_one() would be better when you want to maintain a history of all the version updates (even repeating all the data about the target just changing the version number of a single attribute...)
Ideally, we should have an option to switch between insert or replace.
This PR replaces insert_one() by replace_one() with upsert policy in mongo logging. With upsert, the document in mongo will be replaced if target already exists and inserted if the document doesn't exist. I think that it is more convenient than inserting when the only thing that you want to know is the latest version number of a middleware. I also realize that insert_one() would be better when you want to maintain a history of all the version updates (even repeating all the data about the target just changing the version number of a single attribute...)
Ideally, we should have an option to switch between insert or replace.