Skip to main content

Command Palette

Search for a command to run...

How to add data in MongoDB?

Updated
1 min read
How to add data in MongoDB?
R

Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

The MongoDB shell provides the following methods to insert documents into a collection:

  • To insert a single document, use db.collection.insertOne()
  • To insert multiple documents, use db.collection.insertMany()

Sources:

Insert Documents — MongoDB Shell. www.mongodb.com/docs/mongodb-shell/crud/insert.

More from this blog

R

Raja Muhammad Asher - Senior Software Engineer - Full Stack Developer

157 posts

Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, ExpressJS, MySQL, MongoDB. Love collaborating & making a difference