Our new LangChain Academy Course Deep Research with LangGraph is now live! Enroll for free.
OSS (v1-alpha)
LangChain and LangGraph
# add this import for running in jupyter notebook import nest_asyncio nest_asyncio.apply()
from langchain_community.document_loaders.mongodb import MongodbLoader
loader = MongodbLoader( connection_string="mongodb://localhost:27017/", db_name="sample_restaurants", collection_name="restaurants", filter_criteria={"borough": "Bronx", "cuisine": "Bakery"}, field_names=["name", "address"], )
docs = loader.load() len(docs)
71
docs[0]
Document(page_content="Morris Park Bake Shop {'building': '1007', 'coord': [-73.856077, 40.848447], 'street': 'Morris Park Ave', 'zipcode': '10462'}", metadata={'database': 'sample_restaurants', 'collection': 'restaurants'})