diff --git a/src/row.ts b/src/row.ts index 3a93424e6..804e57361 100644 --- a/src/row.ts +++ b/src/row.ts @@ -555,7 +555,24 @@ export class Row { typeof optionsOrCallback === 'object' ? optionsOrCallback : {}; const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb!; - this.getMetadata(gaxOptions as GetRowOptions, err => { + const options = Object.assign( + { + filter: [ + { + row: { + cellLimit: 1, + }, + }, + { + value: { + strip: true, + }, + }, + ], + }, + gaxOptions + ); + this.getMetadata(options as GetRowOptions, err => { if (err) { if (err instanceof RowError) { callback(null, false); diff --git a/test/row.ts b/test/row.ts index 345adfe84..8daa87650 100644 --- a/test/row.ts +++ b/test/row.ts @@ -21,6 +21,7 @@ import {Mutation} from '../src/mutation.js'; import * as rw from '../src/row'; import {Table, Entry} from '../src/table.js'; import {Chunk} from '../src/chunktransformer.js'; +import {CallOptions} from 'google-gax'; const sandbox = sinon.createSandbox(); @@ -766,18 +767,62 @@ describe('Bigtable/Row', () => { describe('exists', () => { it('should not require gaxOptions', done => { sandbox.stub(row, 'getMetadata').callsFake(gaxOptions => { - assert.deepStrictEqual(gaxOptions, {}); + assert.deepStrictEqual(gaxOptions, { + filter: [ + { + row: { + cellLimit: 1, + }, + }, + { + value: { + strip: true, + }, + }, + ], + }); done(); }); row.exists(assert.ifError); }); - it('should pass gaxOptions to getMetadata', done => { + it('should add filter to the read row options', done => { const gaxOptions = {}; sandbox.stub(row, 'getMetadata').callsFake(gaxOptions_ => { - assert.strictEqual(gaxOptions_, gaxOptions); + assert.deepStrictEqual(gaxOptions_, { + filter: [ + { + row: { + cellLimit: 1, + }, + }, + { + value: { + strip: true, + }, + }, + ], + }); + done(); + }); + row.exists(gaxOptions, assert.ifError); + }); + + it('should pass gaxOptions to getMetadata', done => { + const gaxOptions = { + testProperty: true, + } as CallOptions; + + sandbox.stub(row, 'getMetadata').callsFake(gaxOptions_ => { + assert.strictEqual( + // tslint:disable-next-line no-any + (gaxOptions_ as any).testProperty, + // tslint:disable-next-line no-any + (gaxOptions as any).testProperty + ); done(); }); + row.exists(gaxOptions, assert.ifError); });