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"