I am using loopback. I have user table in mongodb.
I want unique column names(keys) of user table.
I have found below answer in mongodb.
mr = db.runCommand({
"mapreduce" : "my_collection",
"map" : function() {
for (var key in this) { emit(key, null); }
},
"reduce" : function(key, stuff) { return null; },
"out": "my_collection" + "_keys"
})
db[mr.result].distinct("_id")
["foo", "bar", "baz", "_id", ...]
But i am not sure how to do this in loopback.
Can anyone tell me how to implement above code in loopback.