Get keys of a document in MongoDB Document
mongodb, mongoid
Solution
Object.keys(db.users.findOne({username:'xyz@abc.com'}))
will return a list of all the keys of a particular document.
Problem
Is there any way to get the list of keys of a particular document in MongoDB other than iterate through the document? i.e I want to get the keys for the document returned by ``` db.users.find({username:'xyz@abc.com}) ``` Are there any inline commands.If not,can anybody give an idea on how to do?