How can I validate DataBase Records before create it in Firebase?

Hi, How can I validate records during “creating records”?

For example primary key using “E-MAIL”, when I need to garantee that I will have just one record with an specific e-mail; When I put an email that alread exists in database, I expect to receive this messages below
… This e-mail already exists;
… This product already inserted;

Obs: I’m using Firebase in my APP

Get the data from the database first using get record collection. In this ,

IF(COUNT(FIND(appVars.data, email==pageVars.email))==1)

In the first output you display a notice that the data exists

Else

CreateRecord.