Recently in the study of using a non-relational database, the document-based database MongoDB is currently being used. Involves manipulating the MongoDB database using Ruby in a Windows environment. It is therefore necessary to install the Ruby development environment in a Windows environment.
Follow the steps below:
1. First install Ruby
http://rubyinstaller.org/downloads/ version. The author selects ruby2.3.3 ( x64
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/9D/DD/wKioL1mH7FXTT1UCAAPxcSUG24A471.png-wh_500x0-wm_ 3-wmp_4-s_2808686896.png "title=" 11.jpg.png "alt=" Wkiol1mh7fxtt1ucaapxcsug24a471.png-wh_50 "/>
After successfully downloading the installation package, click Install directly, you can check all the options, you must check the second option to add it to the environment variable when installing. After successfully installing Ruby, use the cmd command-line window to test the successful installation of Ruby Ruby–v, and the following interface indicates success with Ruby installation:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/9D/DD/wKioL1mH7VryBtypAAAWnDUC3jo378.png-wh_500x0-wm_ 3-wmp_4-s_1821057768.png "title=" 22.jpg.png "alt=" Wkiol1mh7vrybtypaaawnduc3jo378.png-wh_50 "/>
while installing Ruby, Gem,gem is the package management tool for Ruby, and all kits are installed and maintained through gems. A python-like Pip and php pear tool. Test the gem for a successful installation as in the same way, test directive: gem–v
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/9D/DD/wKioL1mH7jLgNZSPAAAH1v2fIzc953.png-wh_500x0-wm_ 3-wmp_4-s_298458751.png "title=" 33.png "alt=" Wkiol1mh7jlgnzspaaah1v2fizc953.png-wh_50 "/>
2. To use Ruby in a Windows environment, you need to install Devkit
In the same URL above to download the installation package,http://rubyinstaller.org/downloads/
· Devkit-mingw64-64-4.7.2-20130224-1432-sfx.exe
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/9D/DE/wKiom1mH7rDjJa7zAAO4RfvQUy8428.png-wh_500x0-wm_ 3-wmp_4-s_3038547990.png "title=" 44.png "alt=" Wkiom1mh7rdjja7zaao4rfvquy8428.png-wh_50 "/>
2.1 Double click to open the above EXE file, set the decompression path. such as c:\DevKit
After the decompression is complete, the cmd command line enters the extracted path, as described above: C:\DevKit, execute ruby. \DK.RB init, as shown below to indicate success:
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/9D/DE/wKiom1mH70CRhAAxAAAV1vbnH2g064.png-wh_500x0-wm_ 3-wmp_4-s_223285639.png "title=" 55.png "alt=" Wkiom1mh70crhaaxaaav1vbnh2g064.png-wh_50 "/>
2.2 After this step, the CONFIG.YML is generated under the decompression path, first View the generated config.yml exists, and opens the file to confirm whether the content contains the correct Ruby installation path. (If the decompression path and Ruby installation path are not in a single disk, CONFIG.YML does not include the Ruby installation path). If none, add the corresponding Ruby installation path at the end.
As shown in the following:
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/9D/DD/wKioL1mH8BeReOWsAAWuJu27XMM640.png-wh_500x0-wm_ 3-wmp_4-s_3465347205.png "title=" 66.png "alt=" Wkiol1mh8bereowsaawuju27xmm640.png-wh_50 "/>
2.3 After successful execution of the above command, continue with Ruby. \dk.rb Install, the displayed interface indicates successful execution:
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9D/DD/wKioL1mH8FXypig5AAAOLieuN78300.png-wh_500x0-wm_ 3-wmp_4-s_2688293823.png "title=" 77.png "alt=" Wkiol1mh8fxypig5aaaolieun78300.png-wh_50 "/>
At this point, the Ruby development environment is installed.
3. Install the required driver package for MongoDB
in order to use Ruby to manipulate the MongoDB database, you need to install Ruby's for MongoDB driver package, including the following two package files MONGO, and Bson. Since the MONGO package relies on the Bson package, Bson is installed when the MONGO package is installed, and then MONGO is installed. The online installation method is described below. go to the cmd Command Line window and enter the Gem install MONGO directive. The interface looks like this:
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/9D/DD/wKioL1mH8WyiQf6AAAAxxMhsWeE778.png-wh_500x0-wm_ 3-wmp_4-s_4005676841.png "title=" 88.png "alt=" Wkiol1mh8wyiqf6aaaaxxmhswee778.png-wh_50 "/>
Successfully installed
In this case, you can use Ruby to manipulate the MongoDB database in a Windows environment.
This article is from the "techfuture" blog, make sure to keep this source http://wanght89.blog.51cto.com/6778304/1954163
How to implement Ruby operations under Windows MongoDB (Environment installation configuration)