File tree Expand file tree Collapse file tree
handwritten/firestore/dev Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ( ) } ` ;
You can’t perform that action at this time.
0 commit comments