diff options
author | terminaldweller <devi@terminaldweller.com> | 2023-11-17 05:21:27 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2023-11-17 05:21:27 +0000 |
commit | 652832c70b781928ede9f94541601c1beb21dfaa (patch) | |
tree | 14c831733ce40c99683e4941ec764edae4e60693 /put_in_db.js | |
parent | new blog post (diff) | |
download | blog-652832c70b781928ede9f94541601c1beb21dfaa.tar.gz blog-652832c70b781928ede9f94541601c1beb21dfaa.zip |
fixing the duplication issue
Diffstat (limited to 'put_in_db.js')
-rw-r--r-- | put_in_db.js | 9 |
1 files changed, 6 insertions, 3 deletions
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, + } +); |