DEV Community

Aravind
Aravind

Posted on

Mongodb Session

Steps to create MondoDb compass and integrate with Atlas!

=>Go to the Mogodb compass website:[https://www.mongodb.com/try/download/compass] and install it on your system.

=>Then sigin/up to the mongodb atlas.


=> Create cluster using the free plan.

=>Select the browse collection option and click the create database button.

=> Insert new Document add a field and click insert.

=> You can see the changes below!

=> Connect to the cluster by
-> entering default ip address
-> username and password

=> Copy the connection string and go to the mongodb compass
-> select add new connection.
-> paste the URI field with copied string and click connect.
-> You can see the DB has connected successfully!

=>Here under the new connection you can see your database name and the collection name.
-> After select that you can see the document with data you have been inserted in the Atlas.
Click the MongoDB Shell in top right corner!
=> CRUD Operations
1 -> Create operations
show dbs
use test
show collections
db.students.find()
db // shows current database
use sample
db // now shows “sample”


2 ->Add Values
=> One values
db.students.insertOne({ name: "Aravind", age: 20, dept: "Cybersecurity" })
=> Multiple values
db.students.insertMany([
{ name: "Ravi", age: 21, dept: "CSE" },
{ name: "Divya", age: 22, dept: "AI" },
{ name: "Priya", age: 23, dept: "Data Science" }
])

@santhoshnc
@suryaganthan

Top comments (0)