-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -117,7 +118,7 @@ export class Transaction { | |||
|
|||
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.
@@ -883,7 +879,8 @@ describe('getAll() method', () => { | |||
const overrides = {batchGetDocuments: () => stream(found('documentId'))}; | |||
|
|||
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
There was a problem hiding this 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.
This comment was marked as spam.
Sorry, something went wrong.
dev/src/transaction.ts
Outdated
@@ -117,7 +118,7 @@ export class Transaction { | |||
|
|||
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.
@@ -883,7 +879,8 @@ describe('getAll() method', () => { | |||
const overrides = {batchGetDocuments: () => stream(found('documentId'))}; | |||
|
|||
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
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