When performing an aggregate in mongodb using mongoose an empty object is returned, why is this?

This is my first look in anger an node.js and mongodb so its possible I've done something silly or missed something obvious but given the document and the query below, why might a an empty object be returned?

1 Document example

{  
    __v: 0, 
    _id: ObjectId("50bf7f12fc71b74f3b000001"),
    amount: 452.23, 
    categoryId: 13, 
    created: ISODate("2012-12-05T17:06:26Z"), 
    description: "Test", 
    typeId: 1, 
    updated: ISODate("2012-12-05T17:06:26Z")
}

2 Problem code

var Schema = mongoose.Schema;  

var Expense = new Schema({  
    description: { type: String, required: true },  
    amount: { type: Number, required: true },  
    created: { type: Date, default: Date.now },
    updated: { type: Date, default: Date.now },
    categoryId: { type: Number, required: true },
    typeId: { type: Number, required: true }
});

var ExpenseModel = mongoose.model('Expense', Expense);

ExpenseModel.aggregate(  
    { $group: { _id: '$typeId', total: { $sum: '$amount' }}}, 
    function (err, summary) {
        if(err){
            return res.send(500, { error: err }); 
        }

        if(summary) {
            return res.send(summary);
        } else {
            res.send(500, { error: 'couldnt find expenses' }); 
        }
    }
);

Make sure your model is referencing the correct collection and that your passing $group before $project. Here's a complete example:

var db = mongoose.createConnection('localhost:27017/myDatabase');

var expenseSchema = new mongoose.Schema({
    description: { type: String, required: true },  
    amount: { type: Number, required: true },  
    created: { type: Date, default: Date.now },
    updated: { type: Date, default: Date.now },
    categoryId: { type: Number, required: true },
    typeId: { type: Number, required: true }
});

var Expense = db.model('expenses', expenseSchema); // make sure the first argument matches your collection's name

Expense.aggregate(  
    { $group: { _id: '$typeId', expense: { $sum: '$amount' }}}, // 'group' goes first!
    { $project: { _id: 1, expense: 1 }}, // you can only project fields from 'group'
    function(err, summary) {
        console.log(summary);
    }
);

This should give you an output that aggregates all expenses based on "typeId":

[
    { _id: 1, expense: 300.00 },
    { _id: 2, expense: 45.00 },
    ...
]

I just learned about aggregation to answer this question, so tell me if anything goes wrong.

Changing the name of the collection to Expenses from expenses solved the problem.