Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change mongo logging policy to upsert (update by default, insert if new) #319

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

juananpe
Copy link
Contributor

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.

@urbanadventurer
Copy link
Owner

This looks reasonable to me. Thanks @juananpe!

@urbanadventurer urbanadventurer merged commit 6343c9c into urbanadventurer:master Oct 1, 2020
@juananpe juananpe deleted the mongoupsert branch January 1, 2021 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants