相关疑难解决方法(0)

获取集合中所有键的名称

我想获取MongoDB集合中所有键的名称.

例如,从这个:

db.things.insert( { type : ['dog', 'cat'] } );
db.things.insert( { egg : ['cat'] } );
db.things.insert( { type : [] } );
db.things.insert( { hello : []  } );
Run Code Online (Sandbox Code Playgroud)

我想得到独特的钥匙:

type, egg, hello
Run Code Online (Sandbox Code Playgroud)

mongodb mongodb-query aggregation-framework

301
推荐指数
11
解决办法
18万
查看次数