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

最新文章

  1. How to use wget ?
  2. sql查询语句如何解析成分页查询?
  3. 项目差异class文件提取-->上线用
  4. JAVA jdbc(数据库连接池)学习笔记(二) SQL注入
  5. UVa 133,发放救济金
  6. noip赛前小结4
  7. Linux的三种特殊权限
  8. 三个Timer
  9. bzoj1563
  10. Referenced file contains errors (http://www.springframework.org/schema...错误--转载
  11. 《APUE》第三章笔记(3)
  12. 设置ubuntu Android sdk环境变量
  13. 通过Type.InvokeMethod实现方法的重载
  14. Servlet(二)GenericServlet
  15. 松瀚SN8P2711 2722 ADC初始化程序及应用--汇编源码
  16. hdu 1564 Play a game(博弈找规律)
  17. Zend引擎探索 之 PHP中前置递增不返回左值
  18. prototype的一些事
  19. centos mysql 实战 第一节课 安全加固 mysql安装
  20. 模板 Template

热门文章

  1. 异常:java.lang.NoClassDefFoundError: org/springframework/expression/ParserContext
  2. 【转载】Shell 基础 -- 总结几种括号、引号的用法
  3. HTTP请求头的具体含意
  4. 「 Luogu P2574 」 XOR的艺术——线段树
  5. saltstack快速部署
  6. 杭电 4004 The Frog's Games 青蛙跳水 (二分法,贪心)
  7. POJ 3621 Sightseeing Cows (最优比率环 01分数划分)
  8. 解决hibernate产生的id序列或者setXX不能同步到数据库到问题(this.hibernateTemplate.flush();hibernateTemplate.getSessionFactory().getCurrentSession().connection().commit())
  9. 调试jz2440生成特定后缀的命令
  10. 【02】GitHub 工具 Octotree