# Checking if member exists in Members/PrivateMembersData

**URL:** <https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734>\
**Category:** Ask the community\
**Tags:** wix-members-area, code, question\
**Created:** [May 29, 2019, 9:46pm UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734 "2019-05-29T21:46:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![martynas](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/martynas/32/12338_2.png) [@martynas](https://forum.wixstudio.com/u/martynas)\
**Post date:** [May 29, 2019, 9:46pm UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734/1 "2019-05-29T21:46:44Z")

</div>

Trying to check if member already exists in Members collection but no sucess.  
Backend:

**export async function** MemberExists(Email) {  
**const** results = **await** wixData.query(“Members/PrivateMembersData”)  
.eq(‘loginEmail’, Email)  
.find();  
**if** (results.totalCount === 0) {  
**return true**  
}  
}

Any advice how to correctly write call to MemberExists in frontend code? Seems that either backend function is returning undefined results, either I do not correctly call this function. Appreciate any suggestions!

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [May 30, 2019, 12:17am UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734/2 "2019-05-30T00:17:27Z")

</div>

What are you looking to use this searching for an existing email address for?  
[https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields](https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields)

If it is for a simple search of your Members then you can do it by doing something like this below and also have a read of the api reference for query too. [https://www.wix.com/corvid/reference/wix-data.html#query](https://www.wix.com/corvid/reference/wix-data.html#query)

```javascript
import wixUsers from 'wix-users';
import wixData from 'wix-data';

$w.onReady(function () {
	wixUsers.currentUser.getEmail().then((email) => {
		return wixData.query('Members/PrivateMembersData')
			.eq('loginEmail', email)
			.find()
			.then(result => {
				if (result.totalCount === 0) {
					//New user
				} else {
					//Existing user
				}

			});
	});
});

```

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [May 30, 2019, 12:24am UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734/3 "2019-05-30T00:24:05Z")

</div>

Or if it is to do it whilst a user is trying to sign up as a member of your site, then you can just use this tutorial as the code is already done for you.  
[https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area](https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area)

Nayeli (Code Queen) has the same tutorial shown here that also includes a search on the profile page for duplicate entries too.  
[https://codequeen.wixsite.com/membership-dashboard](https://codequeen.wixsite.com/membership-dashboard)  
Video for tutorial above.  
[https://www.youtube.com/watch?v=yLCOqsVHhD0](https://www.youtube.com/watch?v=yLCOqsVHhD0)

Plus, make your own custom branded and designed login and sign up lightboxes too so that you don’t have to navigate away from the page or use Wix own windows to login or signup.  
[https://www.wix.com/corvid/reference/wix-users.html#login](https://www.wix.com/corvid/reference/wix-users.html#login)  
[https://www.wix.com/corvid/reference/wix-users.html#register](https://www.wix.com/corvid/reference/wix-users.html#register)

Again Nayeli (Code Queen) has a good tutorial about making your own lightboxes.  
[https://support.totallycodable.com/en/article/create-custom-log-in-sign-on-screen-using-wix-code](https://support.totallycodable.com/en/article/create-custom-log-in-sign-on-screen-using-wix-code)  
Video for tutorial above.  
[https://www.youtube.com/watch?v=QbH8\_eudjbE&list=PL16sLBOBeiCPEnJFIejV9jCTx\_ZNcyE8\_&index=2&t=0s](https://www.youtube.com/watch?v=QbH8_eudjbE&list=PL16sLBOBeiCPEnJFIejV9jCTx_ZNcyE8_&index=2&t=0s)

Although, if you do the lightbox options, then you will need to change your sign up settings to show that, otherwise you will still have Wix own windows appearing first.  
[https://support.wix.com/en/article/corvid-enabling-custom-site-registration](https://support.wix.com/en/article/corvid-enabling-custom-site-registration)

---

<div class="post-metadata">

**Author:** ![martynas](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/martynas/32/12338_2.png) [@martynas](https://forum.wixstudio.com/u/martynas)\
**Post date:** [May 30, 2019, 8:46am UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734/4 "2019-05-30T08:46:00Z")

</div>

Issue is that I do not have any user logged in. Sequence is: user enters email in textbox with type email → this input is checked in the Wix Memebers database → if no such member, then it is registered and logged in.  
Also, I see You using this code in frontend - are Members/PrivateMembersData functions accessible from frontend code?

```javascript

```

---

<div class="post-metadata">

**Author:** ![JessCK](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jessck/32/81287_2.png) [@JessCK](https://forum.wixstudio.com/u/JessCK)\
**Post date:** [March 25, 2022, 7:11pm UTC](https://forum.wixstudio.com/t/checking-if-member-exists-in-members-privatemembersdata/18734/5 "2022-03-25T19:11:17Z")

</div>

Hi, I’m trying to do the same thing but using the new wixMembers instead of the deprecated wixUsers. Ultimately, I’m trying to create an error message on my custom sign-up lightbox for someone who is trying to “sign-up” using an email address that already exists as a site member. Any suggestions?
