diff --git a/jest.config.js b/jest.config.js index e98bb77a..d130bfea 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,7 +6,7 @@ module.exports = { testTimeout: 60000, // because user will cause other test fail, but we still have user spec coveragePathIgnorePatterns: ['dist'], - testPathIgnorePatterns: ['cloud.spec.ts', 'serverless.spec.ts', 'fetch.spec.ts', 'node-fetch.spec.ts'], // add this line + testPathIgnorePatterns: ['cloud.spec.ts', 'serverless.spec.ts'], // add this line testEnvironmentOptions: { NODE_ENV: 'production', }, diff --git a/milvus/grpc/Data.ts b/milvus/grpc/Data.ts index 7e7f032b..f4974d58 100644 --- a/milvus/grpc/Data.ts +++ b/milvus/grpc/Data.ts @@ -826,6 +826,7 @@ export class Data extends Collection { async count(data: CountReq): Promise { const queryResult = await this.query({ collection_name: data.collection_name, + expr: data.expr || '', output_fields: [DEFAULT_COUNT_QUERY_STRING], }); diff --git a/milvus/types/Data.ts b/milvus/types/Data.ts index b3190a7d..56e7278a 100644 --- a/milvus/types/Data.ts +++ b/milvus/types/Data.ts @@ -69,7 +69,9 @@ export interface FlushReq extends GrpcTimeOut { collection_names: string[]; } -export interface CountReq extends collectionNameReq {} +export interface CountReq extends collectionNameReq { + expr?: string; +} export interface InsertReq extends collectionNameReq { partition_name?: string; diff --git a/package.json b/package.json index abd1578d..005d3e52 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@zilliz/milvus2-sdk-node", "author": "ued@zilliz.com", "version": "2.3.6", - "milvusVersion": "v2.3.4", + "milvusVersion": "v2.3.5", "main": "dist/milvus", "files": [ "dist" diff --git a/proto b/proto index a0a6f5e7..d367b5a5 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit a0a6f5e7eff8b2ca77cfb84b56bdba0204474521 +Subproject commit d367b5a59df171628c736dfb8f05e5f799d13179 diff --git a/test/grpc/Data.spec.ts b/test/grpc/Data.spec.ts index 51a418cd..02593e76 100644 --- a/test/grpc/Data.spec.ts +++ b/test/grpc/Data.spec.ts @@ -458,6 +458,15 @@ describe(`Data.API`, () => { expect(Number(res.data[0][DEFAULT_COUNT_QUERY_STRING])).toEqual(count.data); }); + it(`Query with count(*) and expr`, async () => { + const count = await milvusClient.count({ + collection_name: COLLECTION_NAME, + expr: 'id < 0', + }); + + expect(count.data).toEqual(0); + }); + it(`Query with data limit only`, async () => { const expr = 'id > 0'; const res = await milvusClient.query({