I am getting an issue for running the following aggregate query:
db.snippets.aggregate([ { \'$project\': { month: { \'$month\': \'$created_at\' }} } ])
This error can also appear if you have incorrectly named your properties in your aggregation relative to what they are in your database.
For example my code was
$group: {
_id: {$week: "$projects.timeStamp"},
total: { $sum: "$projects.hours" }
}
But I hadn't camelcased timestamp in my database so simply modifying to projects.timestamp fixed it.