Skip to main content

getKnowledge

codebolt.dbmemory.getKnowledge(key: string): Promise<MemoryGetResponse>
Retrieves a value from the in-memory database by key.

Parameters

NameTypeDescription
keystringThe key of the value to retrieve.

Returns:

 Promise<MemoryGetResponse>
A promise that resolves with the response from the memory get event.

Example


//set the userID and password
const UserID = await codebolt.dbmemory.getKnowledge("UserID")
const Password = await codebolt.dbmemory.getKnowledge("Passowrd")

console.log("UserId------",UserID);
console.log("Password------",Password);

///output

///UserId------ admin
///Password----- Test@123

Explaination

The getKnowledge method retrieves the value associated with a given key from the in-memory database, allowing you to access stored information using the unique identifier provided.