mongodb - 如何发现 mongodb 数据库结构

我有一个不是我创建或架构师的 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/

相关文章:

mysql - 何时使用 MongoDB

mongodb - 所以......这个NoSQL的东西

node.js - MongoDB Node 检查objectid是否有效

MongoDB - $size 的参数必须是一个数组,但类型为 : EOO/missing

node.js - 判断预保存回调中是否有记录 "is new"

c# - 支持和反对从 SQL Server 迁移到 MongoDB 的原因

mongodb - 对 MongoDB $in 查询的响应顺序?

node.js - Mongoose 'static' 方法与 'instance' 方法

mongodb - Mongoose 中权重的全文搜索

.net - 我应该使用哪个 NoSQL 数据库进行日志记录?