IT/Database

[MongoDB] 전체 필드 이름 얻기

DreamKiHyun 2017. 3. 31. 11:28

전체 필드 이름 얻기, 전체 필드 이름 찾기


mr = db.runCommand({

  "mapreduce" : "userlog_table",

  "map" : function() {

    for (var key in this) { emit(key, null); }

  },

  "reduce" : function(key, stuff) { return null; }, 

  "out": "userlog_table" + "_keys"

})



db[mr.result].distinct("_id")



출처: http://eunsood.tistory.com/