MongoDB Foundation Essay (i)

Source: Internet
Author: User
Tags install mongodb mongodb
mongodb文档型数据库,默认端口27017数据库==>>集合==>>文档(BSON)ubuntu安装:sudo apt-get install mongodb-server -y创建数据库存放文件sudo mkdir -p /data/db/启动服务:sudo mongod & (加&让进程在后台运行)查看mongo进程ps -elf | grep mongod进入mongo数据库(默认进入是test)查看数据库(默认有两个 admin local)show dbs查看当前使用的数据库db创建数据库(创建库后,只有插入数据才能show dbs查看到)use 库名插入数据db.库名.insert({" ":""})删除当前数据库(使用use切进去)db.dropDatabase()创建集合(插入数据会自动创建集合)db.createCollection(name,options)name为集合名字options为,可选参数,指定内存大小及索引选项查看已有集合show collections删除指定集合(先查看)db.集合名.drop成功返回true,错误返回false向集合中插入文档db.集合名.insert(dcument) 文档类型为BSON,类似于json

MongoDB Foundation Essay (i)

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.