From the course: MongoDB Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

insertOne and insertMany

insertOne and insertMany - MongoDB Tutorial

From the course: MongoDB Essential Training

insertOne and insertMany

- [Instructor] You've already used the insert commands, but there are some options that we didn't cover that we're going to cover now. To briefly recap, you can insert a document like this, and you can insert many documents at once inside an array like this. When inserting data into a database, a concept that you should be aware of is durability. Durability is a property that guarantees that acknowledged writes are permanently stored in the database, even if the database or parts thereof become temporarily unavailable. In MongoDB, you can configure the level of durability. You can choose to have high durability, but then writes will be slower, or you can choose to have low durability, but faster writes. The way you configured durability in MongoDB is by specifying a writeConcern. The writeConcern defines what MongoDB needs to do before a write is considered successful. You can specify the writeConcern as the second…

Contents