文章详情页
javascript - mongoose 如何获得所有collection
浏览:244日期:2024-03-28 13:07:27
问题描述
我需要统计数据里所有的collection,哪个collection包含最多的数据,请问该如何处理。看到的mongoose都是用model来处理对应的collection,那数据库里有已经导入的大量数据,我该如何获得collection?
问题解答
回答1:获得collections的列表:
1、使用node-mongodb-native驱动的listCollections
http://mongodb.github.io/node...
2、Mongoose中的connection也继承了上述原生驱动:
https://github.com/Automattic...
mongoose.connection.db.listCollections()
包含数量最多的Collection:
需要自己来统计和排序
供参考。
Love MongoDB!Have fun!
回答2:show tables
标签:
JavaScript
相关文章:
1. dockerfile - 为什么docker容器启动不了?2. html5 - node静态资源服务器设置了Cache-Control,但浏览器从来不走3043. angular.js - angular内容过长展开收起效果4. 关于docker下的nginx压力测试5. debian - docker依赖的aufs-tools源码哪里可以找到啊?6. 对html实现监测 发现不对7. docker镜像push报错8. docker内创建jenkins访问另一个容器下的服务器问题9. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?10. 为什么我ping不通我的docker容器呢???
排行榜

网公网安备