GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(firestore): respect `ignoreUndefinedProperties` in subpipelines (… · googleapis/google-cloud-node@a9f6c3f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handwritten/firestore/dev
    • src/pipelines
      • expression.ts
    • system-test
      • pipeline.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handwritten/firestore/dev/src/pipelines/expression.ts‎

Copy file name to clipboardExpand all lines: handwritten/firestore/dev/src/pipelines/expression.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10885,10 +10885,10 @@ class PipelineValueExpression extends Expression {
1088510885
/**
1088610886
* @internal
1088710887
*/
10888-
_validateUserData(_ignoreUndefinedProperties: boolean): void {
10888+
_validateUserData(ignoreUndefinedProperties: boolean): void {
1088910889
// Casting to bypass type checking becuase _validateUserData does not exist in the public types
1089010890
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10891-
(this.pipeline as any)._validateUserData('PipelineValueExpression');
10891+
(this.pipeline as any)._validateUserData(ignoreUndefinedProperties);
1089210892
}
1089310893
}
1089410894

Collapse file

‎handwritten/firestore/dev/system-test/pipeline.ts‎

Copy file name to clipboardExpand all lines: handwritten/firestore/dev/system-test/pipeline.ts
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6216,6 +6216,30 @@ describe.skipClassic('Pipeline class', () => {
62166216
});
62176217
});
62186218

6219+
it('PipelineValueExpression respects ignoreUndefinedProperties', async () => {
6220+
const firestore_2 = getTestDb({ignoreUndefinedProperties: false});
6221+
6222+
const subWithUndefined = firestore_2
6223+
.pipeline()
6224+
.collection('test')
6225+
.where(equal(field('title'), {title: undefined}));
6226+
6227+
try {
6228+
await firestore_2
6229+
.pipeline()
6230+
.collection(randomCol.path)
6231+
.addFields(subWithUndefined.toArrayExpression().as('reviewsData'))
6232+
.execute();
6233+
6234+
expect(false).to.be.true('should have thrown an error');
6235+
} catch (e: unknown) {
6236+
const err: Error = e as Error;
6237+
expect(err.message).to.contain(
6238+
'Cannot use "undefined" as a Firestore value',
6239+
);
6240+
}
6241+
});
6242+
62196243
it('multiple array subqueries', async () => {
62206244
const reviewsCollectionName = `reviews_multi_${Date.now()}`;
62216245
const authorsCollectionName = `authors_multi_${Date.now()}`;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.