- mongo统计字段个数和有值个数
db.getCollection("collection_name").mapReduce(
function() { for (var key in this) { emit(key, 1); } },
function(key, values) { return Array.sum(values); },
{out: {inline: 1}}
)
db.getCollection("collection_name").mapReduce(
function() { for (var key in this) { emit(key, 1); } },
function(key, values) { return Array.sum(values); },
{out: {inline: 1}}
)
本文标题:mongo统计字段个数和有值个数
本文链接:https://www.haomeiwen.com/subject/iqvzohtx.html
网友评论