<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MongoDB &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/category/mongodb/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>Using MongoDB with Express Js</title>
		<link>https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/</link>
		<comments>https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/#respond</comments>
		<pubDate>Thu, 01 Aug 2024 05:45:52 +0000</pubDate>
		<dc:creator><![CDATA[Maxester]]></dc:creator>
				<category><![CDATA[Express Js]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Node Js]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1308</guid>
		<description><![CDATA[<p>MongoDB is a NoSql database which is used to store a large volume of data. NoSql database not uses the tables and rows approach. In MongoDB the database is collection of documents, documents are collection of key-value pairs. Javascript developers&#8230;</p>
<p><a href="https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/">Using MongoDB with Express Js</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>MongoDB is a NoSql database which is used to store a large volume of data. NoSql database not uses the tables and rows approach. In MongoDB the database is collection of documents, documents are collection of key-value pairs. Javascript developers will find it similar to a javascript object.</p>



<p>MongoDB database can perform all types of CRUD (Create, Read, Update, Delete) operations. We use a module called mongoose to connect to the MongoDB database.</p>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://www.maxester.com/blog/wp-content/uploads/2023/12/connection.png" alt="" class="wp-image-1309" srcset="https://www.maxester.com/blog/wp-content/uploads/2023/12/connection.png 567w, https://www.maxester.com/blog/wp-content/uploads/2023/12/connection-300x152.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></figure></div>



<p>In the above code, we have connected our project to the MongoDB database. After that we have created a schema, which defines the structure of the data going to be stored. Then we have created a model and exported that to use in the other parts of the application.</p>



<p></p>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://www.maxester.com/blog/wp-content/uploads/2023/12/add.png" alt="" class="wp-image-1311" srcset="https://www.maxester.com/blog/wp-content/uploads/2023/12/add.png 639w, https://www.maxester.com/blog/wp-content/uploads/2023/12/add-300x164.png 300w" sizes="(max-width: 639px) 100vw, 639px" /><figcaption>Form to create the user</figcaption></figure></div>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://www.maxester.com/blog/wp-content/uploads/2023/12/db.png" alt="" class="wp-image-1310" srcset="https://www.maxester.com/blog/wp-content/uploads/2023/12/db.png 499w, https://www.maxester.com/blog/wp-content/uploads/2023/12/db-271x300.png 271w" sizes="(max-width: 499px) 100vw, 499px" /></figure></div>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/">Using MongoDB with Express Js</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2024/08/01/using-mongodb-with-express-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a DB in MongoDB</title>
		<link>https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/</link>
		<comments>https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/#respond</comments>
		<pubDate>Tue, 22 Oct 2019 03:41:27 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=711</guid>
		<description><![CDATA[<p>It is as simple as calling an URL If you have already installed MongoDB. If Not go-ahead download from here</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/">Creating a DB in MongoDB</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>It is as simple as calling an URL</p>



<p>If you have already installed MongoDB.</p>



<p>If Not go-ahead download from <a href="https://www.mongodb.com/download-center">here  </a></p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>var MongoClient = require('mongodb').MongoClient;
//Create a database named "testdb":
var url = "mongodb://localhost:27017/testdb";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  console.log("Database created!");
  db.close();
});</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/">Creating a DB in MongoDB</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Types of Indexes In MongoDB.</title>
		<link>https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/</link>
		<comments>https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/#respond</comments>
		<pubDate>Mon, 19 Aug 2019 07:24:55 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=610</guid>
		<description><![CDATA[<p>Indexes in MongoDB are just like indexes in the book. Instead of going page by page in a Book one can get to any Topic by searching on the index. In MongoDB, these indexes are made of btree. These btree&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/">Types of Indexes In MongoDB.</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p><strong>Indexes</strong> in MongoDB are just like indexes in the book. </p>



<p>Instead of going page by page in a Book one can get to any Topic by searching on the index.</p>



<p>In <strong>MongoDB</strong>, these indexes are made of <strong>btree</strong>. These btree orders the Documents and guide to the required one with a far lesser read operation.</p>



<p>But all this speed doesn&#8217;t come for free. <strong>Writing operations are inversely proportional to the number of indexes</strong> in a DB. </p>



<p><strong>More the indexes more the need to balance them on every write.</strong></p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>Types of indexes:-</p>



<ul><li><strong>Single Field Index</strong></li></ul>



<p>As the name suggests these are comprised of a single field. This is the simplest form of an index.  </p>



<pre class="wp-block-code"><code>db.your_collection.createIndex(
		 { 
		 	field_to_be_indexed: 1 
		 } 
		)</code></pre>



<p><strong>NOTE:-</strong>  1 at the end of the command is to index in ascending order.</p>



<ul><li><strong>Compound Index</strong></li></ul>



<p>The compound index is those index containing more than one fields. In this type of index, order plays an important role as Mongo Db will create Index in Orderly fashion.</p>



<pre class="wp-block-code"><code>db.your_collection.createIndex(
		 { 
		 	first_field_to_be_indexed: 1, 
		 	second_field_to_be_indexed: 1 
		 } 
		)</code></pre>



<ul><li><strong>Multikey Index</strong></li></ul>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>It is an advanced version of the <strong>compound index</strong> as it can contain array values of subfields in a document. That too multiple of them</p>



<pre class="wp-block-code"><code>db.your_collection.createIndex(
		 { first_field_to_be_indexed: 
		 	[
		 		field1: 1, 
		 		field2: 1
		 	]
		 } 
		)</code></pre>



<p>Multikey indexes are most Complex and needed to execute with utmost precaution as this index can lead to a large index file which can harm the operation of writing anything.</p>



<p><strong>There is more type of indexes that we will talk about in the next part.</strong></p>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/">Types of Indexes In MongoDB.</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/08/19/types-of-indexes-in-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
