diff --git a/llama-index-integrations/readers/llama-index-readers-mongodb/llama_index/readers/mongodb/base.py b/llama-index-integrations/readers/llama-index-readers-mongodb/llama_index/readers/mongodb/base.py index edd19163a93d9ddbc03eccfd5d91641beb19c155..db27a62e2a0e11480b36425299af503a6f1c2a1d 100644 --- a/llama-index-integrations/readers/llama-index-readers-mongodb/llama_index/readers/mongodb/base.py +++ b/llama-index-integrations/readers/llama-index-readers-mongodb/llama_index/readers/mongodb/base.py @@ -78,7 +78,11 @@ class SimpleMongoReader(BaseReader): """ db = self.client[db_name] - cursor = db[collection_name].find(filter=query_dict or {}, limit=max_docs) + cursor = db[collection_name].find( + filter=query_dict or {}, + limit=max_docs, + projection={name: 1 for name in field_names + (metadata_names or [])}, + ) for item in cursor: try: diff --git a/llama-index-integrations/readers/llama-index-readers-mongodb/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-mongodb/pyproject.toml index 5b8e005c953d4db9f0a042e69a09c318623a4b8f..3c8cfa1ed2127297be49b6fc8fa714424f5106fd 100644 --- a/llama-index-integrations/readers/llama-index-readers-mongodb/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-mongodb/pyproject.toml @@ -28,7 +28,7 @@ license = "MIT" maintainers = ["jerryjliu"] name = "llama-index-readers-mongodb" readme = "README.md" -version = "0.1.3" +version = "0.1.4" [tool.poetry.dependencies] python = ">=3.8.1,<4.0"