After uploading csv list how to create db record only if the email does not exist

I have a server action which uploads a csv file and the file is then used to populate a user table. This all works as expected.

However, I am trying figure out how now to add some logic so that if the email already exist in the user table do not create a new User and skip to the next user in the list and so on…

How do I do this? Is it as simple as adding a validation of a all user query in the repeat

On the repeat first check the users email against all emails like below or some other method?


Thanks!

Community Page
Last updated: