From 82357e93eb4ae64c9f0992bfdf3b99e9573d118d Mon Sep 17 00:00:00 2001 From: nameczz Date: Sun, 18 Sep 2022 12:18:27 +0800 Subject: [PATCH] fix consistency_level bug Signed-off-by: nameczz --- example/Collection.ts | 5 ++--- milvus/Collection.ts | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/example/Collection.ts b/example/Collection.ts index 21f4297d..fd3c57c2 100644 --- a/example/Collection.ts +++ b/example/Collection.ts @@ -6,9 +6,8 @@ const collectionManager = milvusClient.collectionManager; const COLLECTION_NAME = GENERATE_NAME(); const test = async () => { - const createRes = await collectionManager.createCollection( - genCollectionParams(COLLECTION_NAME, '4') - ); + const createRes = await collectionManager.createCollection({ + ...genCollectionParams(COLLECTION_NAME, '4')); console.log('--- create collection ---', createRes, COLLECTION_NAME); let res: any = await collectionManager.showCollections(); diff --git a/milvus/Collection.ts b/milvus/Collection.ts index cc32b0a1..2c7d692e 100644 --- a/milvus/Collection.ts +++ b/milvus/Collection.ts @@ -50,7 +50,7 @@ export class Collection extends Client { * | :---------------------- | :---- | :------------------------------- | * | collection_name | String | Collection name | * | description | String | Collection description | - * | consistency_level | String | "Strong" | "Session" (default) | "Bounded"| "Eventually" | "Customized"; | + * | consistency_level | String | "Strong"(Milvus default) | "Session" | "Bounded"| "Eventually" | "Customized"; | * | fields | FieldType | Field data | * | timeout | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined | * @@ -90,7 +90,7 @@ export class Collection extends Client { fields, collection_name, description, - consistency_level = 'Session', + consistency_level = 'Strong', } = data || {}; if (!fields || !fields.length || !collection_name) { throw new Error(ERROR_REASONS.CREATE_COLLECTION_CHECK_PARAMS); @@ -130,9 +130,7 @@ export class Collection extends Client { { ...data, schema: schemaBtyes, - consistency_level: - ConsistencyLevelEnum[consistency_level] || - ConsistencyLevelEnum.Session, + consistency_level: ConsistencyLevelEnum[consistency_level], }, data.timeout );