Answers for "how to return certain keys from mongodb"

1

mongodb get keys of document

var allKeys = {}; db.YOURCOLLECTION.find().forEach(function(doc){Object.keys(doc).forEach(function(key){allKeys[key]=1})}); allKeys;
Posted by: Guest on February-18-2021

Code answers related to "how to return certain keys from mongodb"

Browse Popular Code Answers by Language