diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts index 91095764..a205647f 100644 --- a/nodejs/__test__/table.test.ts +++ b/nodejs/__test__/table.test.ts @@ -362,6 +362,10 @@ describe("When creating an index", () => { for await (const r of tbl.query().where("id > 1").select(["id"])) { expect(r.numRows).toBe(298); } + // should also work with 'filter' alias + for await (const r of tbl.query().filter("id > 1").select(["id"])) { + expect(r.numRows).toBe(298); + } }); // TODO: Move this test to the query API test (making sure we can reject queries diff --git a/nodejs/lancedb/query.ts b/nodejs/lancedb/query.ts index 13604e7c..ec00d6e4 100644 --- a/nodejs/lancedb/query.ts +++ b/nodejs/lancedb/query.ts @@ -114,6 +114,14 @@ export class QueryBase< this.inner.onlyIf(predicate); return this as unknown as QueryType; } + /** + * A filter statement to be applied to this query. + * @alias where + * @deprecated Use `where` instead + */ + filter(predicate: string): QueryType { + return this.where(predicate); + } /** * Return only the specified columns.