Does your use case allow you to prevent users creating duplicates in the first place?

Or, if you want them to create duplicates, why can’t you just display products with different names (e.g Amazon/eBay will let you have the same name as another product and that’s no problem at all)

If you share more about the use case then people here will happily point you in the best direction for your app