From 5fcbe9dd2a789075c0f58828af385bca140fbba4 Mon Sep 17 00:00:00 2001 From: Kushagra <16055492+iamKushagra@users.noreply.github.com> Date: Sun, 10 Mar 2024 03:11:34 +0530 Subject: [PATCH] community[patch]: documented the feature to filter documents in MongoDBloader (#18842) "community[docs]: documented the feature to filter documents in MongoDBloader" - Description: documented the feature to filter documents in MongoDBloader - Feature: the feature https://github.com/langchain-ai/langchain/discussions/18251 - Dependencies: No - Twitter handle: https://twitter.com/im_Kushagra --- .../document_loaders/mongodb.ipynb | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/docs/integrations/document_loaders/mongodb.ipynb b/docs/docs/integrations/document_loaders/mongodb.ipynb index 06728823015..e538114d5c5 100644 --- a/docs/docs/integrations/document_loaders/mongodb.ipynb +++ b/docs/docs/integrations/document_loaders/mongodb.ipynb @@ -42,6 +42,7 @@ "* MongoDB database name\n", "* MongoDB collection name\n", "* (Optional) Content Filter dictionary\n", + "* (Optional) List of field names to include in the output\n", "\n", "The output takes the following format:\n", "\n", @@ -59,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -71,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -80,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -89,21 +90,22 @@ " db_name=\"sample_restaurants\",\n", " collection_name=\"restaurants\",\n", " filter_criteria={\"borough\": \"Bronx\", \"cuisine\": \"Bakery\"},\n", + " field_names=[\"name\", \"address\"],\n", ")" ] }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "25359" + "71" ] }, - "execution_count": 26, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -116,16 +118,16 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Document(page_content=\"{'_id': ObjectId('5eb3d668b31de5d588f4292a'), 'address': {'building': '2780', 'coord': [-73.98241999999999, 40.579505], 'street': 'Stillwell Avenue', 'zipcode': '11224'}, 'borough': 'Brooklyn', 'cuisine': 'American', 'grades': [{'date': datetime.datetime(2014, 6, 10, 0, 0), 'grade': 'A', 'score': 5}, {'date': datetime.datetime(2013, 6, 5, 0, 0), 'grade': 'A', 'score': 7}, {'date': datetime.datetime(2012, 4, 13, 0, 0), 'grade': 'A', 'score': 12}, {'date': datetime.datetime(2011, 10, 12, 0, 0), 'grade': 'A', 'score': 12}], 'name': 'Riviera Caterer', 'restaurant_id': '40356018'}\", metadata={'database': 'sample_restaurants', 'collection': 'restaurants'})" + "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'})" ] }, - "execution_count": 27, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" }