Skip to content

Commit e286f30

Browse files
committed
Merge upstream dev
2 parents 65c4ea5 + 82e834b commit e286f30

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

libs/langchain/langchain/utilities/mongo_database.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from mongoengine import Document, connect, get_db
22
from pymongo import MongoClient
33
from typing import Iterable, List, Optional
4-
from pprint import pprint, List, Optional
5-
import pprint
4+
from pprint import pprint
65
import ast
76

87
def _format_index(index: dict) -> str:
@@ -14,7 +13,6 @@ def _format_index(index: dict) -> str:
1413
f' Keys: {{ {index_keys_formatted} }}'
1514
)
1615

17-
1816
class MongoDBDatabase:
1917
"""MongoEngine wrapper around a database."""
2018

@@ -67,6 +65,7 @@ def get_usable_collection_names(self) -> Iterable[str]:
6765
return sorted(self._include_collections)
6866
return sorted(self._all_collections - self._ignore_collections)
6967

68+
7069
def get_usable_document_names(self, collection_name: str) -> Iterable[str]:
7170
"""Get names of documents available in a given collection."""
7271
if collection_name not in self._ignore_collections:
@@ -99,6 +98,7 @@ def get_collection_info(self, collection_name: str) -> str:
9998

10099
return f"Collection Information for '{collection_name}':\n{formatted_info}"
101100

101+
102102
def get_document_info(self, collection_names: Optional[List[str]] = None) -> str:
103103
"""Get information about specified collections."""
104104
all_collection_names = self.get_usable_collection_names()
@@ -156,8 +156,7 @@ def _execute(self, command: str) -> str:
156156
"""Execute a command and return the result."""
157157
db = get_db()
158158
result = db.command(ast.literal_eval(command))
159-
return f"Result:\n{result}"
160-
159+
return result
161160

162161
def run(self, command: str) -> str:
163162
"""Run a command and return a string representing the results."""

0 commit comments

Comments
 (0)