Adding FieldMask support to GetAll()#443
Conversation
bea0b9d to
6bdd121
Compare
6bdd121 to
01b892d
Compare
| * @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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
dev/src/transaction.ts
Outdated
| 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
738ce7e to
f6cbd36
Compare
schmidt-sebastian
left a comment
There was a problem hiding this comment.
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.
This comment was marked as spam.
Sorry, something went wrong.
dev/src/transaction.ts
Outdated
| 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.
Sorry, something went wrong.
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.
Sorry, something went wrong.
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.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
This adds a
ReadOptionsargument 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