1

Is there a way to find duplicate records ( all occurrences of the duplicates) in a mongo Db collection when queried by a particular field. I am using Spring-data. There is a similar question in SO: Mongo find duplicates for entries for two or more fields

But I would like the duplicated values(documents), not the counts. Is this possible?

ljs
  • 495
  • 1
  • 8
  • 23

1 Answers1

0

You can use $push operator with the the group stage in the aggregation pipeline, to add the duplicate values into an array.