My document used to look like this:
{
  _id : 47cc67093475061e3d95369d, 
  Name : "A name", 
  Description  : "Some description",
  DisciplineCode  : "105",
  DisciplineName  : "A Name",
  OtherProperty : "Something"
}
For which, the following group command worked, in order to get the distinct DisciplineNames and DisciplineCodes from my documents
disciplines = db.result.group({ 
    key: {DisciplineName:1, DisciplineCode:1}, 
    reduce: function(obj, prev) { if (!obj.hasOwnProperty("DisciplineName")) { 
        prev.DisciplineName = obj.DisciplineName; 
        prev.DisciplineCode = obj.DisciplineCode; 
    }}, 
    initial: { } 
});
However, my document has now changed to:
{
  _id : 47cc67093475061e3d95369d, 
  Name : "A name", 
  Description  : "Some description",
  Discipline: {
    Code  : "105",
    Name  : "A Name"},
  OtherProperty : "Something"
}
As you can see, Discipline is an embedded doc.
グループコマンドを変更して同じことを行うにはどうすればよいですか?