diff --git a/packages/firestore/src/api/user_data_reader.ts b/packages/firestore/src/api/user_data_reader.ts index ad57773c420..7bf44458f9c 100644 --- a/packages/firestore/src/api/user_data_reader.ts +++ b/packages/firestore/src/api/user_data_reader.ts @@ -623,7 +623,7 @@ function parseSentinelFieldValue( `${value._methodName}() can only be used with update() and set()` ); } - if (context.path === null) { + if (!context.path) { throw context.createError( `${value._methodName}() is not currently supported inside arrays` ); diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index 3aa5ef83d2b..81ab95b9d86 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -470,6 +470,18 @@ apiDescribe('Validation:', (persistence: boolean) => { } ); + validationIt( + persistence, + 'must not contain field value transforms in arrays', + db => { + return expectWriteToFail( + db, + { 'array': [FieldValue.serverTimestamp()] }, + 'FieldValue.serverTimestamp() is not currently supported inside arrays' + ); + } + ); + validationIt( persistence, 'must not contain directly nested arrays.',