扫码关注官方订阅号
我需要统计数据里所有的collection,哪个collection包含最多的数据,请问该如何处理。看到的mongoose都是用model来处理对应的collection,那数据库里有已经导入的大量数据,我该如何获得collection?
认证高级PHP讲师
获得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!
show tables
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
获得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!
show tables