Recently I attended a workshop on mongoDB organised by LinuxWorld under the mentorship of Vimal Daga sir.

MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program,mongoDB uses JSON-like documents with optional schemas.

🎯In the mongoDB record is known as document and table is known as collection.

🎯mongoDB is NoSQL database. NoSQL database are schema less and thus are flexible. New fields can be generated to store similar data in case we not have data about a field. This way no fields remain null and empty fields are deleted. Each record in NoSQL can have different schema.

🎯Every record in mongoDB will be treated as a document. So it will be schema free data. These type of database also known as document oriented database.

🎯mongoDB have client command that is mongo that will help the client to connect to mongo servers.

🎯python has library pymongo that will helps developers to use mongoDB.pip install pymongo.

some useful command in mongoDB

🎯show dbs -mongoDB will gives some precreted database. e.g admin,config.

🎯use mydb-Create a new Database and goes inside that database.

🎯show collections-It will show collection(table)

🎯db-will help you to show database where are you right now.

🎯db.createCollection(‘testcc’)- will create a collection.

🎯db.testcc.insert({name:‘shubham’})-inserting a document in collection.

🎯db.testcc.find()-will show you all the document.

🎯db.dropDatabase()-will drop mydb database.

🎯db.testcc.find().pretty()-will show output in proper format.

MongoDB indexing

🎯Arranging the document in ascending order and searching on per our to requests that is known indexing. In Google search engine they used indexing for searching.

🎯Indexes support the efficient execution of queries in MongoDB. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement.

🎯You can also include multiple records inside find function- db.contacts.explain(executionstats).find({“dob.age”:{$gt:60},“gender”:male}).

Aggregation pipeline-

🎯Aggregation pipeline uses own keywords. $match-helps to filter document.db.contact.aggregate([{$match:{gender:“female”}}]) above query will searches the record if gender is female.

🎯MongoDB’s aggregation framework is modeled on the concept of data processing pipelines. Documents enter a multi-stage pipeline that transforms the documents into an aggregated result. For example:db.orders.aggregate([
{ $match: { status: “A” } },
{ $group: { _id: “$cust_id”, total: { $sum: “$amount” } } }
])

🎯An aggregation pipeline provides better performance and usability than a map-reduce operation.

Map-reduce operations can be rewritten using aggregation pipeline operators, such as $group,$merge and others.

MongoDB Atlas-

🎯MongoDB Atlas is a fully-managed cloud database developed by same people that build MongoDB. Atlas handles all the complexity of deploying, managing, and healing your deployments on the cloud.

🎯The auto-administration of MongoDB Atlas streamlines operations, reducing TCO and speeding progress. Unlike RDBMS, MongoDB’s built-in scale-out architecture can easily handle huge data volumes and massive traffic.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store