insertOne and insertMany
noun
say it: “in-surt-WUN and in-surt-MEN-ee” /ɪnˌsɝtˈwʌn ænd ɪnˌsɝtˈmɛni/
MongoDB methods that add documents to a collection: insertOne one document, insertMany several at once.
What does insertOne and insertMany do?
insertOne adds one document to a collection; insertMany adds several at once.
db.recipes.insertOne({ title: 'Waffles', minutes: 25 })
db.recipes.insertMany([{ title: 'Tacos' }, { title: 'Soup' }])
In a sentence
- “The seed script adds 20 plants in one call with insertMany.”
- “The sign-up route saves each new member with insertOne.”
Level: Apprentice · More MongoDB terms at this level
Updated