Install MongoDB under CENTOS7 installation Nodejs+express+mongodb+redis

Source: Internet
Author: User
Tags install mongodb mongo shell

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.