How to Insert Documents in MongoDB Using insertOne() | Beginner Tutorial

Опубликовано: 24 Июль 2026
на канале: Fratello Innotech
6
0

Steps to Insert Documents in MongoDB Using insertOne()
1).Open the MongoDB Shell using mongosh.
2).Select the database using use database_name.
3).Create or select a collection.
4).Insert a document using the insertOne() method.
5).Verify the inserted document using find().
Example:
use studentdb

db.students.insertOne({
name: "John",
age: 20,
course: "MongoDB"
})

db.students.find()