Introduction
- This is just an introduction of MEAN Stack and MongoDB.
- I'll write more about MEAN Stack in the future.
- This is the first part of the series of articles which I will write about the MEAN.
What is MEAN Stack ?
- The MEAN stack is a powerful, full-stack JavaScript solution.
- That contains 4 major building blocks or components.
- Which are MongoDB, Express, AngularJS and Node.js
What is MongoDB ?
- MongoDB is an open source, document-oriented database.
- In MongoDB you can store JSON-like documents with dynamic schemas.
What is Express ?
- Express is a minimal and flexible Node.js web application framework.
- It provides a robust set of features for building single and multi-page, and hybrid web applications.
What is AngularJs ?
- AngularJS is a web client framework.
- It extends the HTML vocabulary for your application.
- The resulting environment is extraordinarily expressive, readable, and quick to develop.
What is Node.js ?
- Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.
- It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
- It's perfect for data-intensive real-time applications that run across distributed devices.
What are the advantages of using MEAN stack ?
- A single language is used throughout the application.Which is JavaScript.
- All the parts of the application can support and often enforce the use of the MVC architecture.
- Serialization and deserialization of data structures is no longer needed hence data marshalling is done using JSON objects.
How to Install MongoDB on Windows ?
- My laptop is having Win 8.1 OS.So I'm going to download the Windows 64 bit Msi version.
- You can download it from Here.
Step 2 :
- Just double-click the Msi file.
- Then you'll see a set of screens which will appear to guide you through the installation process.
- I accepted default settings for all the screens.
Step 3 :
Step 4 :
- The default path for the installation as shown below.
Step 4 :
- I have created a new folder named as 'mongodb' on 'c:\' drive.
- This step is optional.You can run MongoDB from any folder as you wish.
- After that contents have been moved into that folder as shown below.
Step 1 :
- MongoDB requires a 'data' directory to store all the data.
- MongoDB’s default data directory path is 'c:\data\db'.
- I have created a 'data\db' folder on 'C' drive.It looks like below.
Step 2 :
- Run 'Command Prompt' with “Administrative Privileges”.
- To start MongoDB, run 'mongod.exe' on command prompt as shown below.
C:\WINDOWS\system32>cd C:\mongodb\bin
C:\mongodb\bin>mongod.exe
- You can see that the main MongoDB service where it starts listening to the default port 27017.
- Which means it starts the main MongoDB database process.
- The 'waiting for connections' message in the console output indicates that the mongod.exe process is running successfully.
How to Create a Windows Service for MongoDB ?
- We can use Windows Service for running MongoDB automatically after every reboot cycle.
- Which is the more popular approach for running MongoDB on windows machines.
- Before we begin setting up MongoDB as a Windows Service, it's considered good practice to specify a path for the MongoDB log and configuration files.Let's do it first.
Step 1 :
- Create a directory inside the 'data' folder as 'log'.
- This is for the log files.It's shown as below.
Step 2 :
- Let's create a configuration file.
- This configuration file can include any of the configuration options for mongod.
- But it must include a valid setting for the 'logpath' which we created on Step 1.
- The following command creates a configuration file, specifying both the 'logpath' and the 'dbpath' settings in the configuration file.
C:\>echo logpath=c:\data\log\mongod.log> "C:\mongodb\mongod.cfg"
C:\>echo dbpath=c:\data\db>> "C:\mongodb\mongod.cfg"
- It creates 'mongod.cfg' file inside the 'C:\mongodb' folder.
- It looks like below.
Step 3 :
- Let's create a MongoDB service.
- For that,you have to run the below mentioned command on command prompt (which is having administrator privileges ( Run as administrator)).
C:\> sc.exe create MongoDB binPath= "\"C:\mongodb\bin\mongod.exe\" --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB 2.6 Standard" start= "auto"
Note : sc.exe requires a space between “=” and the configuration values (eg “binPath= ”), and a “” to escape double quotes.
- If the service was successfully created, you will get the following log message.
[SC] CreateService SUCCESS
Step 4 : Run
- We have installed our MongoDB service.Now you can run it by executing the following command in the command prompt window.
C:\> net start MongoDB
Step 5 : Stop
- If you need to stop the MongoDB service, use the following command.
C:\> net stop MongoDB
How to use the MongoDB shell ?
- You can find out the MongoDB shell inside the 'C:\mongodb\bin' folder.
- Which allows you to interact with MongoDB server instance using the command line.
Step 1 :
- To start the shell, you have to navigate to the mongodb bin folder as shown below.
C:\> cd C:\mongodb\bin
Step 2 :
- After that you can run the 'mongo' service as shown below.
C:\mongodb\bin> mongo
Step 3 :
- Let's do some MongoDB data manipulations.
- Type following command on the MongoDB shell.
> db.books.insert({title: "Hello MEAN World"})
- The preceding command will create a new 'books' collection and insert a JSON object containing a 'title' property.
- To retrieve the book object, execute the following command.
- The shell console will output the following message.
{ "_id" : ObjectId("54cc8cfedc0606c101f00e95"), "title" : "Hello MEAN World" }
- It means your MongoDB instance is working properly and you have successfully managed to interact with it using the MongoDB shell.
- Congratulations !. You have done that.
Step 4 :
- If you need to exit from the shell,just type 'exit'.
> exit
What is Robomongo ?
- Robomongo is a shell-centric cross-platform open source MongoDB management tool (i.e. Admin GUI).
- Robomongo embeds the same JavaScript engine that powers MongoDB's mongo shell.
- Everything you can write in mongo shell where you can write in Robomongo.
How to Install Robomongo on Windows ?
- Just double click the downloaded installer set-up and accept the default settings for all the screens.That's it.
How to work with the Robomongo ?
Step 1 :
- Just double click the auto created 'Robomongo' short cut on the desk top.
- It'll open the GUI of the Robomongo.
Step 2 :
- After that you have to create a connection string for the MongoDB database.
- You can use 'Create' link to create a new database connection as shown below.
- I have given a connection name as 'MongoDbTest' and Address with port number (i.e. port of MongoDB server) as 'localhost : 27017'.
- You can test your connection by using 'Test' button as shown above.
- After that you can use the 'Save' button to save the changes.
Step 3 :
- You can do huge set of MongoDB operations by using this awesome Robomongo GUI.
- Just a few of them are shown below.
- Here I have used the 'test' database with the 'books' collection where we created earlier.
- If you need to see the full list of features, please visit their home page here.
References
Conclusion
- In this article, you learned basics of MEAN stack development.
- You also learned how to install MongoDB and how to connect to your local database instance using the MongoDB shell.
- You also learned how to install and use the MongoDB management tool Robomongo GUI.
- In the next article,we'll discuss how to install Node.js and the basics of Node.js.
- I hope this helps to You.Comments and feedback greatly appreciated.
I hope you post everytime! I love JS
ReplyDeleteHi,
DeleteYou're warmly welcome :)
Yes,Sure, I'll write more about the MEAN Stack in the future.Await for that ....
Thank you for posting the valuable information.
ReplyDeleteMEAN Stack Training in Hyderabad
Nice it seems to be good post... It will get readers engagement on the article since readers engagement plays an vital role in every
ReplyDeletefull stack web developer
Excellent ! I am truly impressed that there is so much about this subject that has been revealed and you did it so nicely
ReplyDeleteThanks
Anika Digital Media
seo services in UK
web design development company in UK
graphic design
angularJs developer in london
This information really worth saying, i think you are master of the content and thank you so much sharing that valuable information and get new skills after refer that post.
ReplyDeleteMean Stack Development Company In India
Mean Stack Development Company In Chennai
Salah seorang sejarawan mengatakan bahwa permainan domino sebelum menjadi domino qq / domino99 online merupakan permainan yang berasal dari negeri Tirai Bambu, Cina. Bentuk domino pertama kali dimainkan oleh tentara Hung Ming pada 181-234 SM
ReplyDeleteasikqq
dewaqq
sumoqq
interqq
pionpoker
bandar ceme terpercaya
hobiqq
paito warna oregon
syair hk
datahk
Awesome Article Keep on sharing
ReplyDeleteFull Stack online Training
Full Stack Training
Full Stack Developer Online Training
Full Stack Training in Hyderabad
Full Stack Training in Ameerpet
Full Stack Training Institute
Thanks for sharing the valuable information. nice blog
ReplyDeleteMeanstack Online Training
Meanstack Online Training in Hyderabad
Meanstack Online Training in Ameerpet
Best Meanstack Online Training
Thank you
I like this blog and i hope you post every time
ReplyDeleteMean stack online training
Mean stack training in hyderabad
The information which you have provided is very good. Keep sharing more relevant information and thanks for sharing with us.
ReplyDeleteMean stack online training
Mean stack training in hyderabad
Thank you for sharing this informatio
ReplyDeleteThank you so much for this useful information. Looking more from your side to update us on more updates
ReplyDeleteNode JS Online training
Node JS training in Hyderabad
Nice information, valuable and excellent in Job, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.mobile phone repair in Novi
ReplyDeleteiphone repair in Novi
cell phone repair in Novi
phone repair in Novi
tablet repair in Novi
ipad repair in Novi
mobile phone repair Novi
iphone repair Novi
cell phone repair Novi
phone repair Novi
The information which you have provided is very good. Keep sharing more relevant information and thanks for sharing with us.Are you interested to develop MEAN Stack Website then we are the best in this.you Feel Free to ask for a dedicated Mean developer and they will handpick some of the best suitable profiles of highly experienced MEAN Stack experts. Mean Stack Development Services
ReplyDeleteThanks for sharing useful information. I learned something new from your bog. Its very interesting and informative. keep updating.
ReplyDeleteDigital Marketing Training in Chennai
Digital Marketing Course in Chennai
MeanStack Development Services
ReplyDeleteopenshift certification
ReplyDeleteazure data engineer certification
aws solution architect training
azure solution architect certification
cloudkeeda
ReplyDeletecloudkeeda
cloudkeeda
cloudkeeda
cloudkeeda
cloudkeeda
cloudkeeda
what is azure
azure free account
Remarkable post. dissertation writing service birmingham
ReplyDeleteaz 900 study guide
ReplyDeleteai 900 study guide
dp 900 study guide
sc 900 study guide
pl 300 study guide
az 204 study guide
az 500 study guide
dp 300 study guide
dp 100 study guide
dp 203 study guide
az 104 study guide
az 600 study guide
mmorpg oyunlar
ReplyDeleteinstagram takipci satin al
tiktok jeton hilesi
tiktok jeton hilesi
Saç ekim antalya
referans kimliği nedir
İNSTAGRAM TAKİPÇİ SATIN AL
Mt2 pvp serverler
instagram takipçi satın al
What I love about the blog is that it covers a wide range of topics, from personal development to lifestyle and travel. Each post is thoughtfully crafted with practical tips and advice that readers can apply in their daily lives. You can learn more about Opencart Web Development Company India for your business needs.
ReplyDeleteOne of the things I appreciated most about the post was the depth of research that had clearly gone into it. This made the post not only informative but also credible and trustworthy and If you want to learn digital marketing course then you should join Digital Marketing Institute Noida as well as you can visit to our website to know more.
ReplyDeleteElevate your email marketing with our expert Mailwizz services. Unlock efficient campaigns and superior deliverability today.
ReplyDeleteThis article explains how to register a Plenty of Fish (POF) account using a Brazil virtual phone number via PVApins. Instead of using your real phone number, which can pose privacy risks, PVApins offers a secure and affordable alternative through virtual SMS activation. The process involves creating an account on PVApins, selecting a Brazil virtual number for POF, using it during registration, and retrieving the verification code to complete the setup.
ReplyDeleteVisit us:- https://pvapins.com/?/EN
This comment has been removed by the author.
ReplyDelete