urbanadventurer / WhatWeb

Next generation web scanner
https://www.morningstarsecurity.com/research/whatweb
GNU General Public License v2.0
5.2k stars 885 forks source link

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

Closed juananpe closed 3 years ago

juananpe commented 3 years ago

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 commented 3 years ago

This looks reasonable to me. Thanks @juananpe!