博客
关于我
MongoDB安装和入门
阅读量:229 次
发布时间:2019-02-28

本文共 2360 字,大约阅读时间需要 7 分钟。

MongoDB????

?????????????????????SQL???????????????????????????????????????????NoSQL??????MongoDB???????????????2019?????SQL??????????????????????????????????????????????????MongoDB?


MongoDB?????

MongoDB???????????????????????????MongoDB????????????????????????????????????????????????????????????????????????????????????????????


MongoDB??

Windows??

  • ??MongoDB??????????????????
  • ?????.msi??????????
  • ?????????????MongoDB???D:\MongoDB\Server\????
  • ????????mongod.cfg???????????????????
  • Linux??

  • ??MongoDB YUM??

    cat /etc/yum.repos.d/mongodb-org-4.2.repo

    ????????????????

  • ????????MongoDB?

    yum updateyum -y install mongodb-org
  • ??MongoDB???

    systemctl start mongod.servicesystemctl enable mongod.service
  • ????????????

    systemctl status mongod.service
  • ????????27017???

    iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT

  • MongoDB????

    ????????

  • ??Robo 3T??MongoDB????
  • ???????????????????????????chapter_1?
  • ????????????????????????????????example_data_1?
  • ????

  • ?C????????????????
    db.getCollection('example_data_1').insertOne({    "name": "???",    "age": 17,    "address": "??"})
  • ??Ctrl + R???????????????
  • ????

  • ???????

    db.getCollection('example_data_1').find()
  • ????????

    db.getCollection('example_data_1').find({'age': 23})
  • ??????

    db.getCollection('example_data_1').find({'age': {'$gt': 21}})
  • ???????

    db.getCollection('example_data_1').find().limit(5)
  • ?????

    db.getCollection('example_data_1').find({'age': {'$gt': 21}}).sort({'age': -1})

  • Robo 3T??

    ??Robo 3T

  • ??Robo 3T??????????????????
  • ????????????????
  • ??MongoDB

  • ??Robo 3T????+?????????????
  • ????????IP?????????IP?????????
  • ??Robo 3T

  • ???????????????????
  • ???????????????????

  • MongoDB????

    ????

  • ???????

    db.getCollection('example_data_1').updateMany({    'name': '???',    'address': '??'}, {    '$set': {        'work': 'DBA'    }})
  • ?????????

    db.getCollection('example_data_1').updateMany({    'name': '???'}, {    '$set': {        'address': '??'    }})
  • #### ????

  • ???????

    db.getCollection('example_data_1').deleteMany({    'hello': 'world'})
  • ???????

    db.getCollection('example_data_1').deleteOne({    'name': '???'})
  • #### ????

  • ???????

    db.getCollection('example_data_1').distinct('age')
  • ????????????????

    db.getCollection('example_data_1').distinct('age', {    'age': {'$gte': 20}})

  • ??

    MongoDB??????????????????????????????????????MongoDB??????????Robo 3T?????????????????MongoDB?????????????????????????????????

    转载地址:http://alti.baihongyu.com/

    你可能感兴趣的文章
    Quarzt定时调度任务
    查看>>