📜  mongodb 获取文档的键 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:57.031000             🧑  作者: Mango

代码示例1
var allKeys = {}; db.YOURCOLLECTION.find().forEach(function(doc){Object.keys(doc).forEach(function(key){allKeys[key]=1})}); allKeys;