From 652832c70b781928ede9f94541601c1beb21dfaa Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 17 Nov 2023 00:21:27 -0500 Subject: fixing the duplication issue --- put_in_db.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'put_in_db.js') diff --git a/put_in_db.js b/put_in_db.js index a9906a3..fadcc42 100644 --- a/put_in_db.js +++ b/put_in_db.js @@ -35,6 +35,9 @@ blogs = [ ]; // db.blogposts.insertMany([blog_entry_1, blog_entry_2, blog_entry_3]); -db.blogposts.updateMany(blogs, { - upsert: true, -}); +db.blogposts.updateMany( + { $set: blogs }, + { + upsert: true, + } +); -- cgit v1.2.3