Match an email field with an existing user?

Hi there. So im trying to make a workflow but getting stuck at one point:

The logged user (Current User) adds a new “friend” but typing the friend’s email into an input. If there is no user with that email, an invite gets sent. (that is worked out).

But, if there is a user with that email, a New Thing is created in the “Relations” table where text fields like “type of relationship” are filled, but one field in that table is of type “User” and I need to add there the new friend, thats where I am stuck.

I am not being able to find the user in the DB that has the Input email and assign its value to the friend field so the relation gets done.

Any ideas?

Just got it! :grinning: By “Searching for users where input email is = to User email” and adding the First Item.

But I worry that doing that search with eventually thousands of user may take a ton of time… Any idea on how to make that query faster?

Hi @jfasja

Bubbles queries are relatively fast. Performance is only really affected when you use the advanced filtered method on a search query as that takes place on the browser after the bubble has already retrieved the data. If your app gets big enough to where you have tens of thousands of users you can migrate your DB else where and run API to get retrieve the data, Thats usually how big companies do it anyways.

Understood. Since on the browser it looks slower when Bubble does a “Search for: with constrains” Vs “Current Users Contacts” I thought it may affect.

But you are right. Eventually if necessary, an API is the solution.

Thanks!