mongodb,v3.2 version, the official website said very detailed, see link: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
1, create the configuration file,
Vi/etc/yum.repos.d/mongodb-org-2.6.repo
[mongodb-org-3.2]name=MongoDB repositorybaseurl=https://repo.mongodb.org/yum/redhat/$ Releasever/mongodb-org/3.2/x86_64/gpgcheck=1enabled=1gpgkey=https:// Www.mongodb.org/static/pgp/server-3.2.asc
2. Installing MongoDB
Yum Install-y mongodb-org
3. Start MongoDB
Service Mongod Start
4. Suspension of Service
Service Mongod Stop
5. Restart Service
Service Mongod Restart
6. Boot start
Chkconfig Mongod on
Another: You can restart the server for testing, Shutdown-r now
7, Installation Mongoose
NPM Install Mongoose--save
MongoDB's curd are as follows:
———— into the MONGO Shell page ————
Mongo
———— Create a database/CREATE TABLE ———— use Testdatabasedb.createcollection (' TestTable ') ———— Show All tables ———— use Testdatabaseshow collections ———— Insert Data- ——— Use Testdatabasecoll=db.getcollection (' testtable ') Coll.insert ({name:"Zhangsan", Password:"123456"}) Coll.insert ({name:"Wanger", Password:"Nicai"}) ———— query data ———— use Testdatabasecoll=db.getcollection (' testtable ') coll.find ()
Install MongoDB under CENTOS7 installation Nodejs+express+mongodb+redis