googleapis / googleapis/google-cloud-node
Add option to only return document data
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
**Is your feature request related to a problem? Please describe.**
Often times, it is known ahead of time that the document reference will not be needed and that all that is needed is the document data. Fetching the entire document increases the size of the document payload by a lot, especially in collection queries when `select()` is used.
**Describe the solution you'd like**
There should be an option when calling `get()` on a query that would allow it to only return the data from the document.
Example:
```javascript
// Proposed method
const userEmails = await firestore.collection('Users').select('Email').get({
dataOnly: true
});
```
should have the same result as:
```javascript
// Current method
const users = await firestore.collection('Users').select('Email').get();
const userEmails = users.docs.map((doc) => doc.data());
```
Contributor guide
Assessment
This issue has not been assessed yet.