Update MongoDBChatMessageHistory to create an index on SessionId (#5632)

All the queries to the database are done based on the SessionId
property, this will optimize how Mongo retrieves all messages from a
session

#### Who can review?

Tag maintainers/contributors who might be interested:
@dev2049
searx_updates
Lucas Rodrigues 12 months ago committed by GitHub
parent 6c11f94013
commit c112d7334d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,6 +47,7 @@ class MongoDBChatMessageHistory(BaseChatMessageHistory):
self.db = self.client[database_name]
self.collection = self.db[collection_name]
self.collection.create_index("SessionId")
@property
def messages(self) -> List[BaseMessage]: # type: ignore

Loading…
Cancel
Save