exception: can't convert from BSON type EOO to Date

前端 未结 8 1300
情歌与酒
情歌与酒 2020-11-28 10:26

I am getting an issue for running the following aggregate query:

db.snippets.aggregate([ { \'$project\': { month: { \'$month\': \'$created_at\' }} } ])
         


        
8条回答
  •  无人及你
    2020-11-28 10:52

    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.

提交回复
热议问题