diff --git a/src/database.ts b/src/database.ts index 381af8e74..fcbb7d451 100644 --- a/src/database.ts +++ b/src/database.ts @@ -2095,7 +2095,7 @@ class Database extends common.GrpcServiceObject { ? (optionsOrCallback as TimestampBounds) : {}; - if ('maxStaleness' in options || 'minReadTimestamp' in options) { + if (options !=null && (options['maxStaleness'] != null || options['minReadTimestamp'] != null)) { const error = Object.assign( new Error( 'maxStaleness / minReadTimestamp is not supported for multi-use read-only transactions.' diff --git a/test/database.ts b/test/database.ts index a3eaf82d7..4f15fc93a 100644 --- a/test/database.ts +++ b/test/database.ts @@ -2331,6 +2331,15 @@ describe('Database', () => { }); }); + it('should pass when maxStaleness is undefined', () => { + const fakeTimestampBounds = {minReadTimestamp: undefined}; + + database.getSnapshot(fakeTimestampBounds, assert.ifError); + + const bounds = snapshotStub.lastCall.args[0]; + assert.strictEqual(bounds, fakeTimestampBounds); + }); + it('should begin a snapshot', () => { beginSnapshotStub.callsFake(() => {});