Search for duplicate entires?

Hi Anthony,
finding duplicates is doable, but not easy, using wix-data.
I will give an outline for how to do it below, but before that, I think there’s a different and simpler approach.

instead of finding dups after the fact, why not prevent them from occurring in the first place?
you can do that relatively easily using data hooks .

all you need to do is implement a “before insert” hook (and maybe a “before update” hook if you let users update their profile), that looks for profiles with the same properties, and reject the insert/update operation if you find anything.

to look for dups, you would create a wix-data query using the OR operator.
the query will look for items that have the relevant email OR the relevant number OR the relevant name.
if it finds anything, your code will reject the operation and return some error code so you can notify your user to change their data.

====

now for finding dups after the fact.
what you can do it run a query that retrieves all records sorted by email (for example).
then go over them one by one, and perform a check to see if the email is the same as the email for the previous item.
if you get two emails that are the same, it means you have a dup.

you can do that for every field (number, name in your example).

the question is, once you find a dup, what then?
for this reason, preventing dups is a much better solution (and better user experience for your users).

hope this helps!