We are Connecting to the database.
mongosh "mongodb+srv://cluster0.ex4ht.mongodb.net/myFirstDatabase" --apiVersion 1 --username YOUR_USER_NAME
We are creating a collection during the insert process.
db.posts.insertOne(object)
We Creating a new database called blog.
use blog
we Creating Collection.
db.createCollection("posts")
We are inserting documents.
db.posts.insertOne({ title: "Post Title 1", body: "Body of post.", category: "News", likes: 1, tags: ["news", "events"], date: Date() })
To verify that it has been installed properly, open your terminal and type.
mongosh --version