I am trying to find the query to find all the fields/keys in collection with 1M records. Buti end up getting this error with output any suggestion on how to overcome this ??
mr = db.runCommand({
"mapreduce" : "MyCollectionName",
"map" : function() {
var f = function() {
for (var key in this) {
if (this.hasOwnProperty(key)) {
emit(key, null)
if (typeof this[key] == 'object') {
f.call(this[key])
}
}
}
}
f.call(this);
},
"reduce" : function(key, stuff) { return null; },
"out": "MyCollectionName" + "_keys"
})
print(db[mr.result].distinct("_id"))
lmdb> print(db[mr.result].distinct("_id"));
MongoServerError: distinct too big, 16mb cap
I am fairly new to mongodb, so forgive my ignorance…