Skip to content

Conversation

@schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Nov 9, 2018

This adds a ReadOptions argument to getAll() to allow users to specify a field mask.

I tried to keep the API useable and declared the first argument of the varargs method so that it is known the DocumentReferences have to be passed first.

Fixes: #42

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 9, 2018
* @param options.fieldMask - The subset of fields to return from a read
* operation.
*/
export function validateReadOptions(options: ReadOptions): boolean {

This comment was marked as spam.

This comment was marked as spam.

if (refOrQuery instanceof DocumentReference) {
return this._firestore
.getAll_([refOrQuery], this._requestTag, this._transactionId)
.getAll_([refOrQuery], null, this._requestTag, this._transactionId)

This comment was marked as spam.

This comment was marked as spam.

dev/src/util.ts Outdated
let documents: DocumentReference[];
let readOptions: ReadOptions|undefined = undefined;

const usesVarags = !Array.isArray(documentRefsOrReadOptions[0]);

This comment was marked as spam.

This comment was marked as spam.

dev/src/util.ts Outdated
documents = documentRefsOrReadOptions as DocumentReference[];
}
} else {
// Support an array of document references as the first argument for

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

return createInstance(overrides).then(firestore => {
return firestore.getAll(firestore.doc('collectionId/documentId'))
return (firestore as InvalidApiUsage)
.getAll([firestore.doc('collectionId/documentId')])

This comment was marked as spam.

This comment was marked as spam.

@gsoltis gsoltis assigned schmidt-sebastian and unassigned gsoltis Nov 10, 2018
Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments addressed. Thanks for the review.

* @param options.fieldMask - The subset of fields to return from a read
* operation.
*/
export function validateReadOptions(options: ReadOptions): boolean {

This comment was marked as spam.

if (refOrQuery instanceof DocumentReference) {
return this._firestore
.getAll_([refOrQuery], this._requestTag, this._transactionId)
.getAll_([refOrQuery], null, this._requestTag, this._transactionId)

This comment was marked as spam.

dev/src/util.ts Outdated
let documents: DocumentReference[];
let readOptions: ReadOptions|undefined = undefined;

const usesVarags = !Array.isArray(documentRefsOrReadOptions[0]);

This comment was marked as spam.

dev/src/util.ts Outdated
documents = documentRefsOrReadOptions as DocumentReference[];
}
} else {
// Support an array of document references as the first argument for

This comment was marked as spam.

return createInstance(overrides).then(firestore => {
return firestore.getAll(firestore.doc('collectionId/documentId'))
return (firestore as InvalidApiUsage)
.getAll([firestore.doc('collectionId/documentId')])

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants