【Mongodb教程 第五课 】MongoDB 删除集合
2024-09-08 08:53:57
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
>
drop() 方法将返回 true,如果选择成功收集被丢弃,否则将返回 false
最新文章
- How to use wget ?
- sql查询语句如何解析成分页查询?
- 项目差异class文件提取-->;上线用
- JAVA jdbc(数据库连接池)学习笔记(二) SQL注入
- UVa 133,发放救济金
- noip赛前小结4
- Linux的三种特殊权限
- 三个Timer
- bzoj1563
- Referenced file contains errors (http://www.springframework.org/schema...错误--转载
- 《APUE》第三章笔记(3)
- 设置ubuntu Android sdk环境变量
- 通过Type.InvokeMethod实现方法的重载
- Servlet(二)GenericServlet
- 松瀚SN8P2711 2722 ADC初始化程序及应用--汇编源码
- hdu 1564 Play a game(博弈找规律)
- Zend引擎探索 之 PHP中前置递增不返回左值
- prototype的一些事
- centos mysql 实战 第一节课 安全加固 mysql安装
- 模板 Template
热门文章
- 异常:java.lang.NoClassDefFoundError: org/springframework/expression/ParserContext
- 【转载】Shell 基础 -- 总结几种括号、引号的用法
- HTTP请求头的具体含意
- 「 Luogu P2574 」 XOR的艺术——线段树
- saltstack快速部署
- 杭电 4004 The Frog's Games 青蛙跳水 (二分法,贪心)
- POJ 3621 Sightseeing Cows (最优比率环 01分数划分)
- 解决hibernate产生的id序列或者setXX不能同步到数据库到问题(this.hibernateTemplate.flush();hibernateTemplate.getSessionFactory().getCurrentSession().connection().commit())
- 调试jz2440生成特定后缀的命令
- 【02】GitHub 工具 Octotree