Below is my code..
group = {
$group: {
"_id": {
"user_email": "$user_email",
"sender_email": "$sender_email"
},
"count": { "$sum": 1 }
}
};
Schema.aggregate(([group]),function(errors,results){
console.log(results);
});
my output value is:
[ { _id:
{ user_email: '123@gmail.com',
sender_email: '235@gmail.com' },
count: 5 },
{ _id:
{ user_email: '123m@gmail.com',
sender_email: '235@gmail.com' },
count: 16 },
{ _id:
{ user_email: '455@gmail.com',
sender_email: '785@gmail.com' },
count: 8 },
{ _id:
{ user_email: '123@gmail.com',
sender_email: '235@gmail.com' },
count: 4 } ]
The above record shows the individual poke count.. i need to know that how many user_email has poked sender_email.(an user_email can poke a sender_email for many times but if the sender_email is poked for many times by a user_email i need not want the count as 'many' but i need the count as 1,in the same way if the various users have poked the sender_email i do not want the count of how many times each user has poked sender_email but how many user_email has poked sender_email). I need a mongoDb query for it?
{ user_email: '123@gmail.com',
sender_email: '235@gmail.com' },
count: 5 }
123@gmail.com poked 235@gmail.com for 5 times but i need to know the count of how many individual sender_email has been poked by various user_email without passing any parameter?
via Jagadeesh
No comments:
Post a Comment