I can reference the values of individual values of attributes in MongoDB aggregation pipeline using '$' operator. But, how do I access (reference) the whole document ?
UPDATE: An example provided to explain scenario.
Here's an example of what I'm trying to do. I have a collection of tweets. And every tweet has a member 'clusters', which is an indication of to what cluster a particular tweet belongs to.
{
"_id" : "5803519429097792069",
"text" : "The following vehicles/owners have been prosecuted by issuing notice on the basis of photographs on dated... http://t.co/iic1Nn85W5",
"oldestts" : "2013-02-28 16:11:32.0",
"firstTweetTime" : "4 hours ",
"id" : "307161122191065089",
"isLoc" : true,
"powertweet" : true,
"city" : "new+delhi",
"latestts" : "2013-02-28 16:35:05.0",
"no" : 0,
"ts" : 1362081807.9693,
"clusters" : [
{
"participationCoeff" : 1,
"clusterID" : "5803519429097792069"
}
],
"username" : "dtptraffic",
"verbSet" : [
"date",
"follow",
"prosecute",
"have",
"be"
],
"timestamp" : "4 hours ",
"entitySet" : [ ],
"subCats" : {
"Generic" : [ ]
},
"lang" : "en",
"fns" : 18.35967,
"url" : "url|109|131|http://fb.me/2CeaI7Vtr",
"cat" : [
"Generic"
],
"order" : 7
}
Since, there are some couple of hundred thousands tweets in my collection, I want to group all tweets by 'clusters.clusterID'. Basically, I would want to write a query like following:
db.tweets.aggregate (
{ $group : { _id : '$clusters.clusterID', 'members' : {$addToSet : <????> } } }
)
I want to access the presently processing document and reference it where I have put in the above query. Does anyone knows how to do this?