mongodb/mongo — pull request #357 by TylerBrock (2013-01-14 22:55:29+00:00)
Title: fix bad error message when attempting to subtract date

Currently, when you try to subtract a date from a number using the aggregation framework you get the confusing error message "exception: cant $subtract a Date from a Date".

Here's an example:
```
bigbrock(mongod-2.3.2-pre-) test> db.s6239.aggregate({
$project: {out: {$subtract: [1, '$date']}}
});
Error: Printing Stack Trace
at printStackTrace (src/mongo/shell/utils.js:37:7)
at DBCollection.aggregate (src/mongo/shell/collection.js:866:1)
at (shell):1:10
Tue Jan 8 17:29:36.095 javascript execution failed src/mongo/shell/collection.js:867 aggregate failed: {
"errmsg": "exception: cant $subtract a Date from a Date",
"code": 16614,
"ok": 0
}
```

The error message was constructed using the wrong side of the subtraction. I've provided a fix and a test to confirm it works correctly.