Skip to content

Commit

Permalink
Merge pull request #106 from milvus-io/dev
Browse files Browse the repository at this point in the history
fix consistency_level bug
  • Loading branch information
nameczz authored Sep 19, 2022
2 parents b367c74 + 82357e9 commit c235f42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions example/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 3 additions & 5 deletions milvus/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 | <a href="https://github.com/milvus-io/milvus-sdk-node/blob/main/milvus/types/Collection.ts#L8" target="_blank">FieldType</a> | 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 |
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
);
Expand Down

0 comments on commit c235f42

Please sign in to comment.