Cómo descargar e instalar MongoDB on Windows y nube
⚡ Resumen inteligente
Cómo descargar e instalar MongoDB on Windows and Cloud is explained as a complete setup guide. This resource covers installing MongoDB Community Server on Windows, JavaTexto, Python, and Ruby drivers, MongoDB Compass, configuration with import and export, a config file, and deploying MongoDB Atlas on the cloud.

Los instaladores de 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.
Cómo descargar e instalar MongoDB on Windows
Los siguientes pasos se pueden utilizar para descargar e instalar MongoDB on Windows 10:
Paso 1) Descargar MongoDB Community Server
Vaya a la este enlace y descarga MongoDB Servidor comunitario. Instalaremos la versión de 64 bits para Windows.
Paso 2) Haga clic en Configuración
Once the download is complete, open the msi file. Click Next in the start-up screen.
Paso 3) Acepte el Acuerdo de licencia de usuario final
- Acepte el Acuerdo de licencia de usuario final.
- Haga clic en Siguiente.
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.
Paso 5) Configuración del servicio
- Select “Run service as Network Service user”. Make a note of the data directory; we will need this later.
- Haga clic en Siguiente.
Paso 6) Iniciar el proceso de instalación
Haga clic en el botón Instalar para iniciar la instalación.
Step 7) Click Next once completed
Installation begins. Click Next once completed.
Paso 8) Haga clic en el botón Finalizar
Final step: once the installation is complete, click on the Finish button.
Hola Mundo MongoDB: JavaControlador de script
Conductores en MongoDB are used for connectivity between client applications and the database. For example, if you had a Java programa y requirió que se conectara a MongoDB, then you would require to download and integrate the Java controlador para que el programa pueda funcionar con el MongoDB base de datos.
el conductor para JavaScript sale de la caja. MongoDB shell which is used to work with the MongoDB database is actually a JavaScript shell. To access it:
Paso 1) Go to “C:\Program Files\MongoDB\Server\4.0\bin” y haga doble clic en mongo.exe. Alternativamente, también puede hacer clic en el MongoDB desktop item.
Paso 2) Enter the following program into the shell:
var myMessage='Hello World'; printjson(myMessage);
Code Explicación:
- Sólo estamos declarando una simple JavaScript variable to store a string called ‘Hello World’.
- Estamos utilizando el método printjson para imprimir la variable en la pantalla.
Instale Python Destornillador
Paso 1) Asegúrese de que Python is installed on the system.
Paso 2) Install the mongo related drivers by issuing the below command:
pip install pymongo
Instalar el controlador Ruby
Paso 1) Ensure Ruby is installed on the system.
Paso 2) Ensure gems is updated by issuing the command:
gem update --system
Paso 3) Install the mongo related drivers by issuing the below command:
gem install mongo
Instale MongoDB Compass – MongoDB Herramienta de administracion
Existen en el mercado herramientas disponibles para gestionar MongoDB. Una de esas herramientas no comerciales es MongoDB Compass. Some of the features of Compass are given below:
- Full power of the Mongo shell
- Múltiples conchas
- Múltiples resultados
Paso 1) Vaya a la este enlace and click download.
Paso 2) Enter details in the popup and click submit.
Paso 3) Double click on the downloaded file.
Paso 4) Installation will auto-start.
Paso 5) Compass will launch with a Welcome screen.
Paso 6) Keep the privacy settings as default and click “Start Using Compass”.
Paso 7) You will see the home screen with a list of current databases.
MongoDB Configuración, importación y exportación
Antes de iniciar el MongoDB servidor, el primer aspecto clave es configurar el directorio de datos donde se encuentran todos los MongoDB data will be stored. This can be done in the following way:
El comando anterior 'md \data\db' crea un directorio llamado \data\db en su ubicación actual. MongoDB creará automáticamente las bases de datos en esta ubicación, porque esta es la ubicación predeterminada para MongoDB para almacenar su información. Simplemente nos estamos asegurando de que el directorio esté presente, para que MongoDB Puede encontrarlo cuando comienza.
La importación de datos a MongoDB Esto se hace con el comando “mongoimport”. El siguiente ejemplo muestra cómo se puede hacer.
Paso 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.
Paso 2) Issue the mongoimport command.
Code Explicación:
- We are specifying the db option to say which database the data should be imported to.
- The type option is to specify that we are importing a csv file.
- 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.
Resultado
El resultado muestra claramente que se importaron 3 documentos a MongoDB.
Exportación MongoDB is done by using the mongoexport command.
Code Explicación:
- Estamos especificando la opción db para indicar desde qué base de datos se deben exportar los datos.
- We are specifying the collection option to say which collection to use.
- The third option is to specify that we want to export to a csv file.
- El cuarto es especificar qué campos de la colección deben exportarse.
- La opción –out especifica el nombre del archivo csv al que exportar los datos.
Resultado
El resultado muestra claramente que se exportaron 3 registros desde MongoDB.
Configurando MongoDB servidor con archivo de configuración
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:
Paso 1) Create a file called “mongod.conf” and store the below information in the file.
- 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.
- La segunda opción es mencionar que la ubicación será un archivo.
- This mentions the location of the log file.
- LogAppend: "true" significa garantizar que la información de registro se siga agregando al archivo de registro. Si pone el valor como "falso", el archivo se eliminará y se creará de nuevo cada vez que el servidor se inicie nuevamente.
Paso 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.
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.
Cómo instalar MongoDB en la nube (AWS, Google, Azure)
You do not need to install the MongoDB server and configure it. You can deploy a MongoDB Servidor Atlas en la nube en plataformas como AWS, Google Cloud, y Azure, and connect to the instance using a client. Below are the detailed steps:
Paso 1) Vaya a la este enlace.
- Ingrese sus datos personales
- Está de acuerdo con los términos
- Click the button “Get Started Free”
Paso 2) Click “Build my first cluster”.
Paso 3) Puede seleccionar entre AWS, Google Cloud, y 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.
Paso 4) Cluster creation takes some time.
Paso 5) After some time you will see the cluster ready.
Paso 6) Click Security > Add new user.
Paso 7) En la siguiente pantalla:
- Introduzca las credenciales de usuario
- Asignar privilegios
- Click the Add User button
Paso 8) In the dashboard, click the connect button.
- Incluya en la lista blanca su conexión IP
- Elige el método de conexión
Paso 9) Select the connection method of your choice to connect to the MongoDB servidor.


































