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):
{ \"m
A for ... in loop should do the trick:
for ... in
> var message = db.messages.findOne(); > for (var key in message) { ... print(key); ... }