Skip to content

Commit

Permalink
Merge branch 'main' of github.com:milvus-io/milvus-sdk-node
Browse files Browse the repository at this point in the history
  • Loading branch information
shanghaikid committed Jan 25, 2024
2 parents a59f070 + 040ccf0 commit d61b23b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
1 change: 1 addition & 0 deletions milvus/grpc/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ export class Data extends Collection {
async count(data: CountReq): Promise<CountResult> {
const queryResult = await this.query({
collection_name: data.collection_name,
expr: data.expr || '',
output_fields: [DEFAULT_COUNT_QUERY_STRING],
});

Expand Down
4 changes: 3 additions & 1 deletion milvus/types/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion proto
9 changes: 9 additions & 0 deletions test/grpc/Data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit d61b23b

Please sign in to comment.