How to have multiple users on one Database but each user only sees their own content

Hello all,

I just created a notes function on my app. I have one Database storing all the notes. I want each user to be able to create and see ONLY their own content. Any idea how to restrict the content so that users cannot see one another’s content?

ie. User A can only see User A’s notes and User b cannot see user A’s notes but can see user b’s notes.

thanks in advance for your time!

Hi @Nb317 :wave:

Create a relationship property between your Notes collection and Users Collection. One to Many. Then property ( User ) will be created on Notes collection and opposite property ( Notes ) will be created on Users collection. Then go to the create note action and add Logged in user to the User Property and filter the list as Logged in user > Notes.

Hope it helps!

Thank you

2 Likes

Hey Dilon,

First, thank you!

I was able to follow your directions in creating the 1 to many relationship between notes and users.

Exactly what u said would happen did happen.

But i am having a hard time following the second half of your instructions (sorry i’m new to all this). How do i add “logged in user to the user property” all i see is the screen shot i have attached here:

thanks for your help!

So to go off what Dillon said, you’ll do this on the same screen that will be displaying your notes data. Add a list and just set to “logged in users notes” … when the user logs in and go to the notes page they will see only their notes.

1 Like

Your welcome :+1:

Are you using the form component to create the Note?

Yes, I am using the form component to create the note.

I tried doing what Jacob told me and now no notes will display. I looked at the database for the notes and the User section is blank. How do I tell the note which user is creating it?

thanks!

Ok so in your form go to the fields section and add the User property on automatically section and add the value as Logged in user and add the list and set the filter as Logged in user > Notes

It’s because the User property is Empty. Not matching with the filter

IT WORKED !!

THANK YOU!!!

Really appreciate your help!

1 Like

Your welcome :+1:

Probably way late but could you explain HOW you got it to work?