我有一个不是我创建或架构师的 Mongo 数据库,有没有一种很好的方法来自省(introspection)数据库或打印出结构是什么来开始处理正在存储的数据类型,数据如何类型是嵌套的,等等?
最佳答案
只需在 mongo shell 中运行以下命令即可查询数据库:
use mydb //this switches to the database you want to query
show collections //this command will list all collections in the database
db.collectionName.find().pretty() //this will show all documents in the database in a readable format; do the same for each collection in the database
然后您应该能够检查文档结构。
https://stackoverflow.com/questions/14713179/