Created
January 3, 2019 13:18
-
-
Save pablocattaneo/2ba2a2baf72aad0a0b69da411bee2a65 to your computer and use it in GitHub Desktop.
How to add next document although the previous fails in mongoDb? #mongoDb #mongoShell
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.collectionName.insertMany( | |
[ <document 1> , <document 2>, ... ], | |
{ ordered: false } | |
) | |
// Example | |
db.products.insertMany( [ | |
{ _id: 10, item: "large box", qty: 20 }, | |
{ _id: 11, item: "small box", qty: 55 }, | |
{ _id: 11, item: "medium box", qty: 30 }, | |
{ _id: 12, item: "envelope", qty: 100}, | |
{ _id: 13, item: "stamps", qty: 125 }, | |
{ _id: 13, item: "tape", qty: 20}, | |
{ _id: 14, item: "bubble wrap", qty: 30} | |
], { ordered: false } ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment