aboutsummaryrefslogtreecommitdiffstats
path: root/put_in_db.js
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-11-17 05:21:27 +0000
committerterminaldweller <devi@terminaldweller.com>2023-11-17 05:21:27 +0000
commit652832c70b781928ede9f94541601c1beb21dfaa (patch)
tree14c831733ce40c99683e4941ec764edae4e60693 /put_in_db.js
parentnew blog post (diff)
downloadblog-652832c70b781928ede9f94541601c1beb21dfaa.tar.gz
blog-652832c70b781928ede9f94541601c1beb21dfaa.zip
fixing the duplication issue
Diffstat (limited to 'put_in_db.js')
-rw-r--r--put_in_db.js9
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,
+ }
+);