The field name is mispelled. Should be visit_time not visit_date.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
I tried on 2.1.0 (osx64 bit) and it worked fine:
> db.runCommand({aggregate: "userlog", pipeline: [{$project: {user_id:
... 1, visit_date: {$year: "$visit_time"}, _id: 0}}, {$match: {user_id:
... 277797}}]})
{
"result" : [
{
"user_id" : 277797,
"visit_date" : 2012
}
],
"ok" : 1