MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Install: 1. Run: D: Toolsmongodbbingt; mongod -- dbpathE: MyProject on the console
MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Installation: 1. Run: D: \ Tools \ mongodb \ bingt; mongod -- dbpath E: \ MyProject \ on the console \
MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Installation:
1. Run: D: \ Tools \ mongodb \ bin> mongod -- dbpath "E: \ MyProject \ Web \ mongo \ data" on the console. Note that mongod is not mongo. It took me more than 10 minutes to solve the problem. You can also use the default DB, and create the db \ data folder under drive C. You do not need to add the following parameters. Run cmdd.exe directly.
2. Start another console and run: D: \ Tools \ mongodb \ bin> mongo to view the Mongo system prompt.
3. MongoDB provides a database named test by default, so you can use it directly:
> Db. test. save ({a: 1 })
> Db. test. find ()
4. It's really convenient!
---------------------------------------------
Continue. It is a little troublesome to start two consoles with MongoDB each time. Fortunately, in Versions later than 2.0, it can run as a service for windows:
1. Prepare two items: log folder and configuration file.
2. Create: E: \ MyProject \ Web \ mongo \ log
3. Create the configuration file mongod. cfg in the MongoDB installation directory. The content is as follows:
Logpath = E: \ MyProject \ Web \ mongo \ log \ mongo. log
Dbpath = E: \ MyProject \ Web \ mongo \ data
Note that dbpath must be filled in correctly, otherwise the service will not run normally!
4. Use the Administrator permission to install the service: D: \ Tools \ mongodb \ bin> mongod -- config "D: \ Tools \ mongodb \ mongod. cfg" -- install
5. A service named MongoDB will be installed in the system. You can manually start the service or execute net start MongoDB to start the service. If the service script is wrong, you can delete the service by running the command "C: \ mongodb \ bin \ mongod.exe -- remove" or "SC delete mongoDB.
Related reading: VMWare's Cloud Foundry practice (2): successful connection with MongoDB