From 4dc0441448b17938918cd2a71b16f004f6a7852c Mon Sep 17 00:00:00 2001 From: Juanan Pereira Date: Fri, 28 Aug 2020 16:46:56 +0200 Subject: [PATCH] change mongo logging policy to upsert (update by default, insert if new) --- lib/logging/mongodb.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logging/mongodb.rb b/lib/logging/mongodb.rb index ca6b575d3..900e07f15 100644 --- a/lib/logging/mongodb.rb +++ b/lib/logging/mongodb.rb @@ -92,7 +92,7 @@ def out(target, status, results) else Helper::utf8_elements!(foo) # convert foo to utf-8 flatten_elements!(foo) - @coll.insert_one(foo) + @coll.replace_one({ target: foo[:target]}, foo, { upsert: true}) end end end