Sample data import in MongoDB using mongoimport - Part 9

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to mongodb tutorial in this tutorial we will learn how to import a sample json data using mongodb import utility so i have listed all the steps which we are going to perform in this notepad so the first step is we will download the import utility so what we will do is we will go to internet explorer or in my case it is it is chrome and we will just say mongodb.com try slash download slash database underscore tool soup so what happens by default import is not included in your in your installable directory so it is not available as such so what we will do is we will go and download the mongodb database tools so you can see the available download you just press the download and it is a zip file which will be which will be downloaded and what we have to do then is we have to unzip that file so once you unzip that file so you will get a file like this mongodb hyphen database tools windows x64 x86 64 something like that and once you unzip that it will be available like this and you will be able to see some bin directory or bin folder in this you just click that and you will be able to see these utilities based on dump.exe mongodump export import for for our demo says import.exe is required so what we will do is we'll just copy and paste this and put it in the the bin directory of our our mongodb where it is installed so my mongodb 4.4 instance is installed and see dollar program files mongodb server 4.4 and bin and i have just pasted it over there this is the first step how do we bring uh import utility in in the bin directory of mongodb where it has been installed and the second step is we have to download the sample uh json file so what we have so it is already provided by mongodb so what you have to say is media.mongodb.org json so what you have to do is you just have to right click and just say save as and you have to save this file in in some directory and i have already copied it as a sample json data something like that so i have copied in my c drive like sample data from mongodb dot json so what we are going to do now is i have opened a command prompt and what we will do is uh let me see if my is running or not so this is the shell cls i have cleared the screen let's say show dbs okay we have something called a sample data so let me uh okay we will create a new one so we will be using import utility so we'll see import and we will say where do we want to import it we will be importing it into a database we will say it is new db and and we will put it into a collection which is called as collection as a keyword then we will say new collection new collection and then collection name we have mentioned then we will see the hyphen hyphen file hyphen hyphen file and will give the complete location of that file then that file is here in c drive something like this sample data from mongodb.json so and it is available in c drive so i'll say c drive i hope the syntax is correct import let me refer to the document so mongodb import hyphen iphone uh database name hyphen knife and collection collection name hyphen hyphen file and the complete location of the json file and just press enter you can see that it is connected to the local mongodb instance and it has imported 29 500 353 documents let's go inside let's say i will log in and we'll see whether it is imported correctly or not so we say and let's clear the screen just say show dbs and we created a database with the name new db so let's say use new db and if we say show collections it will show us all the collections which are are available under this particular database so it is new collection so let us see if it whereas available the data is available or not so we'll say db which is a keyword then the collection name i will say new collection and let's display the details we'll say fine and you can see that it is displayed and if you see i t it will display more and the import is successful just to recap of what we have done download the import it is not mongodb it is import utility you have to download database tools zip file unzip it and copy that executable under the the folder where your bin is available let's it is in c c drive program files and i'll read out where it is c drive program files mongodb server 4.4 and bin copy this utility over there and then just download the sample json file which is available in media.mongodb.org and then fire this command import hyphen iphone db simple data hyphen iphone collection collection name and hyphen hyphen file the the file name i hope is going to help and thanks for watching
Info
Channel: E-MultiSkills Database services
Views: 22,032
Rating: undefined out of 5
Keywords: How to load a sample data in mongodb, how to get and load a test data in mongodb, sample data for mongodb on my system
Id: n_mdEM9iPCE
Channel Id: undefined
Length: 7min 19sec (439 seconds)
Published: Tue Sep 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.