兴国资源网 Design By www.nnzcdc.com
创建集合:createCollection() 方法
MongoDB db.createCollection(name, options)
语法:
基本的 createCollection() 命令语法如下:
db.createCollection(name, options)
选项"border-bottom-style: solid; border-bottom-color: rgb(214,214,214); padding-bottom: 0px; border-right-style: solid; background-color: rgb(247,247,247); border-top-color: rgb(214,214,214); margin: 8px 0px; padding-left: 0px; width: 560px; padding-right: 0px; border-collapse: collapse; font-family: Helvetica, Arial, sans-serif; border-top-style: solid; color: rgb(0,0,0); border-right-color: rgb(214,214,214); vertical-align: top; border-left-style: solid; border-left-color: rgb(214,214,214); padding-top: 0px">
当插入文档,MongoDB 第一检查大小字段封顶集合,然后它会检查最大的字段中。
例子:
createCollection() 方法不使用选项的基本语法如下:
>use test switched to db test >db.createCollection("mycollection") { "ok" : 1 } >
>show collections mycollection system.indexes
>db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } ) { "ok" : 1 } >
在MongoDB中,不需要创建集合。当插入一些文件 MongoDB 自动创建的集合。
>db.yiibai.insert({"name" : "yiibai"}) >show collections mycol mycollection system.indexes yiibai >
删除集合:drop() 方法
MongoDB 的
db.collection.drop()
语法:
drop() 命令的基本语法如下
db.COLLECTION_NAME.drop()
首先,检查可用的集合在数据库 mydb
>use mydb switched to db mydb >show collections mycol mycollection system.indexes yiibai >
现在删除集合名称为 mycollection
>db.mycollection.drop() true >
>show collections mycol system.indexes yiibai >
兴国资源网 Design By www.nnzcdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
兴国资源网 Design By www.nnzcdc.com
暂无评论...
更新日志
2024年05月13日
2024年05月13日
- 薛凯琪.2006-ElectricAngel(特别加歌版)【华纳】【WAV+CUE】
- 死尸死时四十四 死屍死時四十四
- 黄雀在后!
- 冤家变亲家 Mother of the Bride
- 刘梅《射雕宋韵雅乐原声带·壹》[320K/MP3][149.77MB]
- 刘梅《射雕宋韵雅乐原声带·壹》[FLAC/分轨][309.73MB]
- 群星《情迷雪域》[WAV分轨][1.1G]
- 破碎之地体力怎么用 行动力耐力合理使用攻略
- 原神风行迷踪谋策之局活动介绍 策略追猎挑战
- 决胜巅峰阿格斯技能怎么用 技能效果介绍
- 暗区突围正版官网入口分享 暗区突围官网下载链接
- 暗区突围PC端怎么下载 暗区突围PC端下载教程
- 暗区突围PC端官网入口 暗区突围国际服官网链接
- 《王国之泪》一周年!塞尔达公主声优晒手绘贺图庆祝
- Tango工作室关闭 玩家上Steam好评轰炸《完美音浪》