Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

fix(mongodb): fix system db unauthorized ops on remote managed

Christian59bab70eb494
diff --git a/src/config.py b/src/config.py
index 8e50345..42a9678 100644
--- a/src/config.py
+++ b/src/config.py
@@ -110,6 +110,7 @@ class MongoConfig:
self.password = os.getenv("MONGO_PASSWORD")
self.connection_string = os.getenv("MONGO_CONNECTION_STRING")
+ self.system_database = os.getenv("MONGO_SYSTEM_DATABASE", "_system")
if [self.host, self.port, self.username, self.password].count(
None
diff --git a/src/lib/mongo/client.py b/src/lib/mongo/client.py
index a7a985d..b93bcbe 100644
--- a/src/lib/mongo/client.py
+++ b/src/lib/mongo/client.py
@@ -141,7 +141,7 @@ class MongoClient(DataClient):
return brain
def get_brain(self, name_key: str) -> Brain:
- collection = self.get_collection("brains", "system")
+ collection = self.get_collection("brains", config.mongo.system_database)
result = collection.find_one({"name_key": name_key})
if not result:
return None
@@ -152,7 +152,7 @@ class MongoClient(DataClient):
)
def get_brains_list(self) -> List[Brain]:
- collection = self.get_collection("brains", "system")
+ collection = self.get_collection("brains", config.mongo.system_database)
result = collection.find()
return [
Brain(