C
C#3mo ago
Zoli

How to get documents for specific user by Cloud Firestore?

I am developing a .NET MAUI application where users can register and sign in. After logging in, they can perform CRUD operations on documents. Each document saved to Cloud Firestore includes a user_id or owner_id property to indicate the owner. What is the best way to filter documents so that I only retrieve those associated with a specific user? Currently, I am using: CollectionReference documentsRef = db.Collection("documents"); and then querying for documents where UserId equals the currentUserId. Is this the correct approach, or does this method initially retrieve all documents from the collection (for all users) before filtering by UserId?
2 Replies
Salman
Salman3mo ago
There must be a method to fetch the document by Id. Look into their docs you will find it
Zoli
ZoliOP3mo ago
So my question was mainy about each document has a property which is the user id of who created that document. When I want to fetch all document for the logged in user. Is it right to do the filter on the client side?

Did you find this page helpful?