New Member Registration - Email address is not being stored in the database

@stcroppe - YOU are obviously WAYYYYYY smarter than me! I am certain that all of this would make perfect sense to someone closer to your speed, but you just left me in the dust, lol! Thanks sooooo much for your help though. I’m trying my best to make heads or tails of it. I’m almost positive that I am in total agreement with this part of your post: "If you need your membership records to be unique based on email address [I would :-)] so your email address is a unique data collection key which you should (as you have already ascertained) check for not the _id. So your code needs to be as follows. This will prevent multiple records being added with the same key email address. " So I made the following change:

 // prompt the user to log in 
        wixUsers.promptLogin({ "mode": "login" })
            .then((user) => {
                userId = user.id;
 return user.getEmail();
            })
            .then((email) => {
 // check if there is an item for the user in the collection
                userEmail = email;
 return wixData.query("Profile")
                    .eq("email", userEmail) < -- -- -- -- -- -- - ensure unique use of email
                    .find();
            })
            .then((results) => {
 // if an item for the user is not found
 if (results.items.length === 0) {
 // create an item
 const toInsert = {
 "_id": userId,
 "email": userEmail
                    };
 // add the item to the collection
                    wixData.insert("Profile", toInsert)
                        .catch((err) => {
                            console.log(err);
                        });
                }
 // update buttons accordingly
                $w("#register").label = "Logout";
                $w("#showdashboard").show();
            })
            .catch((err) => {
                console.log(err);
            });
    }
} 

Unfortunately, I got an error on this line:

   .eq("email", userEmail) < -- -- -- -- -- -- - ensure unique use of email 

This is the part of your post where things get super confusing for me: "Now the other problem that exists with the wix CRM is that it allows multiple records with the same email address. If you use wix-crm to create a contact and wix-users to register and log in then you will get two records with the same email . . . " I definitely need my user’s email addresses to be unique.

If you record the id created by wix-crm.createContact it will not be the same one generated by wix-users.register(). The id you need to record for log in purposes is the one from the register() function.
How would I go about achieving this?

Now the only way to send a triggered email when the user is NOT logged in is using the wix-crm.emailContact function not wix-users.emailUser. What this means is that you also need the id from wix-crm.createContact so you need to track both id’s in your user “Profile” data collection and use the correct one for the specific purpose you have in mind. "
How would I go about achieving this?

I’ve read countless posts (including the one you referred to in your post) trying to see if I could figure this out on my own, but unfortunately, I’m not advanced enough fill in the holes.

I am SO grateful for any additional help you’re willing to provide with this!!!