Docs Home → Develop Applications → MongoDB Manual
Insert Methods
This version of the documentation is archived and no longer supported. View the current documentation to learn how to upgrade your version of MongoDB server.
MongoDB provides the following methods for inserting documents into a collection:
Additional Methods for Inserts
The following methods can also add new documents to a collection:
db.collection.updateOne()
when used with theupsert: true
option.db.collection.updateMany()
when used with theupsert: true
option.db.collection.findAndModify()
when used with theupsert: true
option.db.collection.findOneAndUpdate()
when used with theupsert: true
option.db.collection.findOneAndReplace()
when used with theupsert: true
option.
See the individual reference pages for the methods for more information and examples.