0

I'm using Firebase Firestore. How to correctly write a query so as not to return some of the lines from the document? For example, don't return the created_at field. There is a variation of all fields that do not need to be returned to hide in the subdocument. But then how, in the future, can you make a request using a condition if the field by which you need to form a condition is in a subdocument?

PS: Fields should not appear at the user level.

pie
  • 127
  • 9

1 Answers1

1

When using the Firestore web and mobile client libraries, it's not possible to exclude some fields from a document. All queried documents will contain all fields for every query. If you need to restrict access to some fields, you should split those into another collection, and use security rules to make sure that users who should not see them do not have access to query that collection.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441