Kuidas alla laadida ja installida MongoDB on Windows ja Pilv

โšก Nutikas kokkuvรตte

Kuidas alla laadida ja installida MongoDB on Windows and Cloud is explained as a complete setup guide. This resource covers installing MongoDB Community Server on Windows, Javaskript, Python, and Ruby drivers, MongoDB Compass, configuration with import and export, a config file, and deploying MongoDB Atlas on the cloud.

  • ๐ŸชŸ Windows Paigaldage: Download the 64-bit Community Server and run the MSI installer.
  • ๐Ÿ”Œ Autojuhid: JavaScript ships built in; add Python (pymongo) and Ruby (mongo) drivers.
  • ๐Ÿงญ Kompass: Paigaldage MongoDB Compass GUI to manage databases visually.
  • โš™๏ธ Konfiguratsioon: Set the data directory, import/export CSV, and use a config file.
  • โ˜๏ธ Pilv: juurutada MongoDB Atlas on AWS, Google Cloudvรตi Azure and connect a client.

Kuidas alla laadida ja installida MongoDB

Paigaldajad jaoks MongoDB are available in both the 32-bit and 64-bit format. The 32-bit installers are good for development and test environments. But for production environments you should use the 64-bit installers. Otherwise, you can be limited in the amount of data that can be stored within MongoDB. It is advisable to always use the stable release for production environments.

Kuidas alla laadida ja installida MongoDB on Windows

Allalaadimiseks ja installimiseks saab kasutada jรคrgmisi samme MongoDB on Windows 10:

Samm 1) Laadige alla MongoDB รœhenduse Server

Mine link ja laadige alla MongoDB kogukonna server. Installime 64-bitise versiooni Windows.

Laadige alla ja installige MongoDB on Windows

Samm 2) Klรตpsake nuppu Seadistamine

Once the download is complete, open the msi file. Click Next in the start-up screen.

Laadige alla ja installige MongoDB on Windows

3. samm) nรตustuge lรตppkasutaja litsentsilepinguga

  1. Accept the End-User License Agreement.
  2. Klรตpsake nuppu Edasi.

Laadige alla ja installige MongoDB on Windows

Step 4) Click on the โ€œCompleteโ€ button

Click on the โ€œCompleteโ€ button to install all of the components. The custom option can be used to install selective components or if you want to change the location of the installation.

Laadige alla ja installige MongoDB on Windows

Samm 5) Teenuse konfigureerimine

  1. Select โ€œRun service as Network Service userโ€. Make a note of the data directory; we will need this later.
  2. Klรตpsake nuppu Edasi.

Laadige alla ja installige MongoDB on Windows

6. samm) alustage installiprotsessi

Installimise alustamiseks klรตpsake nuppu Installi.

Laadige alla ja installige MongoDB on Windows

Step 7) Click Next once completed

Installation begins. Click Next once completed.

Laadige alla ja installige MongoDB on Windows

Samm 8) Klรตpsake nuppu Lรตpeta

Final step: once the installation is complete, click on the Finish button.

Laadige alla ja installige MongoDB on Windows

Tere maailm MongoDB: JavaSkripti draiver

Autojuhid sisse MongoDB are used for connectivity between client applications and the database. For example, if you had a Java programm ja nรตudis sellega รผhenduse loomist MongoDB, then you would require to download and integrate the Java draiver, et programm saaks koos tรถรถtada MongoDB andmebaas.

Juht jaoks JavaScript tuleb karbist vรคlja. The MongoDB shell which is used to work with the MongoDB database is actually a JavaScript shell. To access it:

Step 1) Go to โ€œC:\Program Files\MongoDB\Server\4.0\binโ€ ja topeltklรตpsake failil mongo.exe. Teise vรตimalusena vรตite klรตpsata ka MongoDB desktop item.

Tere maailm MongoDB: JavaSkripti draiver

Step 2) Enter the following program into the shell:

var myMessage='Hello World';
printjson(myMessage);

Tere maailm MongoDB: JavaSkripti draiver

Code Selgitus:

  1. Me kuulutame lihtsalt vรคlja lihtsa JavaScript variable to store a string called โ€˜Hello Worldโ€™.
  2. Kasutame muutuja ekraanile printimiseks printjsoni meetodit.

paigaldama Python juht

Step 1) Tagama Python is installed on the system.

Step 2) Install the mongo related drivers by issuing the below command:

pip install pymongo

Installige Ruby draiver

Step 1) Ensure Ruby is installed on the system.

Step 2) Ensure gems is updated by issuing the command:

gem update --system

Step 3) Install the mongo related drivers by issuing the below command:

gem install mongo

paigaldama MongoDB Compass - MongoDB Haldustรถรถriist

Turul on haldamiseks saadaval tรถรถriistu MongoDB. รœks selline mitteรคriline tรถรถriist on MongoDB Compass. Some of the features of Compass are given below:

  1. Full power of the Mongo shell
  2. Mitu kestat
  3. Mitu tulemust

Step 1) Mine link and click download.

paigaldama MongoDB Compass

Step 2) Enter details in the popup and click submit.

paigaldama MongoDB Compass

Step 3) Double click on the downloaded file.

paigaldama MongoDB Compass

Step 4) Installation will auto-start.

paigaldama MongoDB Compass

Step 5) Compass will launch with a Welcome screen.

paigaldama MongoDB Compass

Step 6) Keep the privacy settings as default and click โ€œStart Using Compassโ€.

paigaldama MongoDB Compass

Step 7) You will see the home screen with a list of current databases.

paigaldama MongoDB Compass

MongoDB Konfigureerimine, import ja eksport

Enne MongoDB server, esimene vรตtmeaspekt on konfigureerida andmekataloog, kus kรตik MongoDB data will be stored. This can be done in the following way:

MongoDB Konfigureerimine, import ja eksport

รœlaltoodud kรคsk 'md \data\db' loob teie praeguses asukohas kataloogi nimega \data\db. MongoDB loob sellesse asukohta andmebaasid automaatselt, kuna see on vaikekoht MongoDB selle teabe salvestamiseks. Me lihtsalt tagame kataloogi olemasolu MongoDB leiab selle, kui see algab.

Andmete importimine MongoDB tehakse kรคsu "mongoimport" abil. Jรคrgmine nรคide nรคitab, kuidas seda teha.

Step 1) Create a CSV file called data.csv and put the following data in it:

Employeeid,EmployeeName
1,Guru99
2,Mohan
3,Smith

So in the above example, we are assuming we want to import 3 documents into a collection called data. The first row is called the header line, which will become the field names of the collection.

Step 2) Issue the mongoimport command.

MongoDB Konfigureerimine, import ja eksport

Code Selgitus:

  1. We are specifying the db option to say which database the data should be imported to.
  2. The type option is to specify that we are importing a csv file.
  3. Remember that the first row is called the header line, which will become the field names of the collection; that is why we specify the โ€“headerline option. And then we specify our data.csv file.

Vรคljund

MongoDB Konfigureerimine, import ja eksport

Vรคljund nรคitab selgelt, et imporditi 3 dokumenti MongoDB.

Eksport MongoDB is done by using the mongoexport command.

MongoDB Konfigureerimine, import ja eksport

Code Selgitus:

  1. Tรคpsustame suvandi db, et รถelda, millisest andmebaasist andmed eksportida.
  2. We are specifying the collection option to say which collection to use.
  3. The third option is to specify that we want to export to a csv file.
  4. Neljas on mรครคrata, millised kogu vรคljad tuleks eksportida.
  5. Valik โ€“out mรครคrab selle csv-faili nime, kuhu andmed eksportida.

Vรคljund

MongoDB Konfigureerimine, import ja eksport

Vรคljund nรคitab selgelt, et 3 kirjet eksporditi MongoDB.

Seadistamine MongoDB server koos konfiguratsioonifailiga

One can configure the mongod server instance to start up with a configuration file. The configuration file contains settings that are equivalent to the mongod command-line options. For example, suppose you wanted MongoDB to store all its logging information to a custom location, then follow the below steps:

Step 1) Create a file called โ€œmongod.confโ€ and store the below information in the file.

Seadistamine MongoDB Server koos konfiguratsioonifailiga

  1. The first line of the file specifies that we want to add configuration for the system log file, that is where the information about what the server is doing goes, in a custom log file.
  2. Teine vรตimalus on mainida, et asukohaks on fail.
  3. This mentions the location of the log file.
  4. LogAppend: "tรตene" tรคhendab tagamist, et logiteavet lisatakse logifaili pidevalt. Kui mรครคrate vรครคrtuseks "false", siis fail kustutatakse ja luuakse vรคrskena, kui server uuesti kรคivitab.

Step 2) Start the mongod server process and specify the above created configuration file as a parameter. The screenshot of how this can be done is shown below.

Seadistamine MongoDB Server koos konfiguratsioonifailiga

Once the above command is executed, the server process will start using this configuration file, and if you go to the /etc directory on your system, you will see the mongod.log file created. The below snapshot shows an example of what a log file would look like.

Seadistamine MongoDB Server koos konfiguratsioonifailiga

Kuidas paigaldada MongoDB pilves (AWS, Google, Azure)

You do not need to install the MongoDB server and configure it. You can deploy a MongoDB Atlase server pilves sellistel platvormidel nagu AWS, Google Cloudja Azure, and connect to the instance using a client. Below are the detailed steps:

Step 1) Mine link.

  1. Sisestage isiklikud andmed
  2. Nรตus tingimustega
  3. Click the button โ€œGet Started Freeโ€

paigaldama MongoDB Pilve peal

Step 2) Click โ€œBuild my first clusterโ€.

paigaldama MongoDB Pilve peal

Step 3) Saate valida vahel AWS, Google Cloudja Azure as your cloud provider. In this tutorial, we will use AWS, which is set by default. Make no other changes on the page and click โ€œCreate Cluster".

paigaldama MongoDB Pilve peal

Step 4) Cluster creation takes some time.

paigaldama MongoDB Pilve peal

Step 5) After some time you will see the cluster ready.

paigaldama MongoDB Pilve peal

Step 6) Click Security > Add new user.

paigaldama MongoDB Pilve peal

Step 7) Jรคrgmisel ekraanil:

  1. Sisestage kasutaja mandaadid
  2. Mรครคra รตigused
  3. Click the Add User button

paigaldama MongoDB Pilve peal

Step 8) In the dashboard, click the connect button.

  1. IP-รผhenduse valgesse nimekirja
  2. Valige รผhendusviis

paigaldama MongoDB Pilve peal

Step 9) Select the connection method of your choice to connect to the MongoDB server.

paigaldama MongoDB Pilve peal

KKK

Yes. AI assistants can generate mongod configuration files, explain connection errors, and suggest fixes for driver or service issues. You should still verify commands against the official MongoDB documentation before applying them.

Jah. MongoDB Atlas includes Atlas Vector Search and AI integrations that let you build semantic search and retrieval-augmented generation apps. It stores embeddings alongside documents, removing the need for a separate vector database.

Jah. MongoDB Community Server is free and open source for Windows, macOSja Linux. MongoDB Atlas also provides a free cloud tier, while Enterprise Edition adds paid advanced features and support.

Community Server is installed and managed on your own machine or server. Atlas is a fully managed cloud service that handles setup, scaling, backups, and security on AWS, Google Cloudvรตi Azure.

Vรตta see postitus kokku jรคrgmiselt: