Thanks for the response! I'm glad you found value in the article!

There are a few different ways that you could accomplish this. First, if you're going to have Firebase authentication, you'll want to implement Firestore rules that would prohibit someone from viewing another person's ToDos: https://firebase.google.com/docs/firestore/security/rules-structure

As far as data structure, there are two ways I would handle this:

Option 1

ToDos collection that would include the users ID on each ToDo. Then your firestore property in the file would read something like this:

firestore: {

ToDos: db.collection("ToDos").where("userId", "==", <THE_USERS_ID>)

}

Option2

I typically create a users collection when I use Firebase Auth and set the document id of each users doc to the user ID provided by Firebase auth. In that case, you could use a subcollection off of the user collection for their todos. Then your firestore property would be:

firestore: {

ToDos: db.collection("users").doc(<THE_USERS_ID>).collection("ToDos")

}

I did some minimal testing on this and it looks like VueFire respects the filters while still keeping the realtime functionality.

I hope this helped!

Written by

Full-stack developer developer for 7+ years with a passion for learning new things and sharing. For more, check out diligentdev.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store