2

How do you get all fields except specific fields of all documents in a collection?

saw this and this but im trying to avoid the overhead of fetching values of fields that may be pretty big (e.g screenshot) when i do not need them, so how do i do that right?

Ofek Ron
  • 8,354
  • 13
  • 55
  • 103

1 Answers1

1

Whenever you execute a query (or read an entire collection) in Firestore through the Python SDK, you can specify a so-called projection, which is documented as:

projection: (Optional[google.cloud.proto.firestore.v1. query.StructuredQuery.Projection])

A projection of document fields to limit the query results to.

I couldn't quickly find a code-sample, but this is the field to specify in your code.

Note for others landing here: the ability to request only specific fields is only available in the server-side/Admin SDKs for Firestore. There is no equivalent in the client-side SDKs.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807