KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there a way to figure out the fields/keys in a document while in mongo's shell? As an example, let's say we have a document like (pseudocode): { "message": "Hello, world", "from": "hal", "field": 123 } I'd like to run a command in the shell that returns the list of fields/keys in that document. For instance, something like this: > var message = db.messages.findOne() > message.keys() ... prints out "message, from, field"
Tags (comma-separated)
Save Edits
Cancel