Created
July 1, 2023 15:20
-
-
Save mehdishahdoost/aeabe3e1a60f7b3795a0adfc8d4352ee to your computer and use it in GitHub Desktop.
mongodb-bulk-insertion-scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db = db.getSiblingDB('dbname'); | |
| insertBulk = function() { | |
| var bulk = db.books.initializeUnorderedBulkOp(); // or we can use db.books.initializeOrderedBulkOp(); | |
| for(loop=0;loop<1000;loop++) { | |
| bulk.insert({name: "Moon"}); | |
| } | |
| bulk.execute(); | |
| } | |
| insertBulk(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment