Fieldnames in MongoDB with PHP

I am trying to get a list of all my field names with MongoDB in PHP.

Something like this: http://geoff.com.au/content/get-list-all-fields-mongodb-collection

My code doesn’t give me the names of the fields.

How can I get the names of all the fields?

Php

$map = new MongoCode("function() { for (var key in this) { emit(key, null); }}");
$reduce = new MongoCode("function(key, stuff) { return null; }");

$discipline = $db->command(array(
 "mapreduce" => "blueprint_expressions",
 "map" => $map,
 "reduce" => $reduce,
 "query" => array("expression" => "discipline"),
 "out" => "discipline_keys"));

var_dump($discipline);

Output

array(4) {
["result"] "discipline_keys"
["timeMillis"] 3
["counts"] array(4) {
["input"] 1
["emit"] 6
["reduce"] 0
["output"] 6
}
["ok"] 1
}