Advertisement
Guest User

Untitled

a guest
May 4th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. db.feeds.aggregate(
  2.     { $group: {
  3.         // Group by fields to match on (a,b)
  4.         _id: { link: "$link" },
  5.  
  6.         // Count number of matching docs for the group
  7.         count: { $sum:  1 },
  8.  
  9.         // Save the _id for matching docs
  10.         docs: { $push: "$_id"}
  11.     }},
  12.  
  13.     // Limit results to duplicates (more than 1 match)
  14.     { $match: {
  15.         count: { $gt : 1 }
  16.     }}
  17. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement