meetjoshi

Duplicate asatoAssetId Mongo Pipeline - softwareAsset

Aug 27th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. [
  2. {
  3. $group: {
  4. _id: "$asatoAssetId",
  5. count: {
  6. $sum: 1
  7. },
  8. documents: {
  9. $push: "$$ROOT"
  10. }
  11. }
  12. },
  13. {
  14. $match: {
  15. count: {
  16. $gt: 1
  17. }
  18. }
  19. },
  20. {
  21. $project: {
  22. documents: 1,
  23. _id: 0
  24. }
  25. },
  26. {
  27. $unwind: "$documents"
  28. },
  29. {
  30. $replaceRoot: {
  31. newRoot: "$documents"
  32. }
  33. }
  34. ]
  35.  
Advertisement
Add Comment
Please, Sign In to add comment