MongoDb Tutorial #01 What's MongoDB , MongoDB Databases , Collections And Documents

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@alexendre-maxim·
0.000 HBD
MongoDb Tutorial #01 What's MongoDB , MongoDB Databases , Collections And Documents
<html>
<h2><img src="https://user.oc-static.com/upload/2017/09/08/15048760157749_MongoDB.png" width="633" height="172"/></h2>
<p><a href="https://user.oc-static.com/upload/2017/09/08/15048760157749_MongoDB.png">Image Source</a></p>
<h2>Repository</h2>
<p>https://github.com/mongodb/mongo</p>
<h2>What Will I Learn?</h2>
<p>I will learn what's the mongoDb and where to use it , what's the databases and how to create show and drop databases , also what's the collections how to create delete show collections and finally what's the documents how to create &nbsp;, update , delete and fetch documents .</p>
<ul>
  <li>What's mongoDB and where to use it.</li>
  <li>What's the databases and how to create and delete databases .</li>
  <li>What's collections and how to create , show and delete collections .</li>
  <li>What's the documents and how to insert , update , delete and fetch documents .</li>
</ul>
<h2>Requirements</h2>
<ul>
  <li>You must have knowledge about the databases&nbsp;</li>
  <li>You Must have an installed version of mongoDB</li>
  <li>You should know the basics of SQL &nbsp;</li>
</ul>
<h2>Difficulty</h2>
<ul>
  <li>Basic</li>
</ul>
<h2>Description</h2>
<p>In this tutorial we will talk about mongoDB , what's the mongoDB , mongoDB databases , collections and documents .</p>
<h3>1- What's mongoDB ?</h3>
<p>In the past, there was talk about the known data bases between the poles of the programmers from different levels, starting from web developers to the software developers on different platforms, OSX, Linux. The talk was about one type only, RDBMS Relational database management system such as MS SQL Server , IBM DB2, Oracle, MySQL, and Microsoft Access, which rely on saving data within tables. But recently, after the release of a number of JS Frameworks and the rise in the number of JavaScript users, 10GEN started working on a database of a completely different type It is a NoSQL under the name of MongoDB which is a database that has no relationship between the tables and is dependent .</p>
<h3>2 - MongoDB Databases :&nbsp;</h3>
<p><strong>a- What is a database ?</strong></p>
<p>Is a set of tables linked to each other to store information so that it can be easily modified and deleted and searched for automatically</p>
<p><strong>b- Creation of databases :&nbsp;</strong></p>
<p>To create a database you type just ' <code>use nameOfDatabase</code> ' , if there is a database with this name it will switch to it, but if it doesn't exist it will create a new database .</p>
<p><strong>c- Show databases :&nbsp;</strong></p>
<p>To show databases that you have created you must type the command <code>show dbs </code>to show all databases that you have in your local machine .</p>
<p><strong>d- Drop databases :</strong></p>
<p>To drop database you must firstly use it by the <code>use </code>command , then you type <code>db.dropDatabase() </code>it will give as the true value that the database was successfully removed .</p>
<h3>3- Collections :&nbsp;</h3>
<p><strong>a- What's the collections ?</strong></p>
<p>It is similar to the concept of tables in relational database systems, we use it to store data</p>
<p><strong>b- Creation of collections :&nbsp;</strong></p>
<p>To create a collection we have two ways :&nbsp;</p>
<p>- The first is to use ' db.createCollection(name) ' where the name is the name of the collection .</p>
<p>- The second way is to use ' db.createCollection(name, options) ' where the options contains 4 parameters&nbsp;</p>
<p>{ capped : true/false , autoIndexId : true/false , size : number , max : number }</p>
<p><strong>c- Drop Collections :&nbsp;</strong></p>
<p>To delete a collection you must write the name of the collectio then the use the drop method ' <code>db.nameOfCollection.drop()</code> ' it will be removed .</p>
<h3>4- Documents :&nbsp;</h3>
<p><strong>a- what's the documents ?</strong></p>
<p>It's data stored in collections , it depends on ' &nbsp;<strong>Binary Encoding Of JSON Objects</strong> &nbsp;' format.</p>
<p><strong>b- Creation of document :&nbsp;</strong></p>
<p>To create a new document we must use the collection then insert into it a new document as an object&nbsp;</p>
<p><code>db.nameOfCollection.insert({name:'alexendre'})</code></p>
<p><strong>c-Update document :&nbsp;</strong></p>
<p>To update document we can use the update method that has two parameters , the first is the document that we want to update and the second is the document that we will set&nbsp;</p>
<p><code>db.nameOfCollection.update({name:'alexendre'},{name:'maxim'})</code></p>
<p><strong>d- Delete document :&nbsp;</strong></p>
<p>To remove a document we use the remove method , but it must has a query or a condition for example&nbsp;</p>
<p><code>db.nameOfCollection({name:'alexendre'})</code></p>
<p>it will remove the document that has the name equals to alexendre.</p>
<p><strong>e- Fetch data :</strong>&nbsp;</p>
<p>To get the data in a collection we use the find() method it will give as the data as &nbsp;<strong>Binary Encoding Of JSON Objects</strong> format</p>
<p><code>db.nameOfCollection.find()</code></p>
<p>To get the first object of this collection we use <code>db.nameOfCollection.findOne()</code> , it will give us the first document.</p>
<p>And we have other method to show the documents in other form <code>db.nameOfCollection.find().pretty()</code></p>
<h2>Video Tutorial</h2>
<p>https://www.youtube.com/watch?v=3-AJdqFdEjc</p>
<h2>Curriculum</h2>
<ul>
  <li>This is the first tutorial in this series .</li>
</ul>
<h2>Proof of Work Done</h2>
<p>https://github.com/alexendre-maxim/mongoDB</p>
</html>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,