ajosh0504 commited on
Commit
1e1b445
·
verified ·
1 Parent(s): 44dd41c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -0
README.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-3.0
3
+ task_categories:
4
+ - question-answering
5
+ language:
6
+ - en
7
+ tags:
8
+ - vector search
9
+ - retrieval augmented generation
10
+ size_categories:
11
+ - <1K
12
+ ---
13
+
14
+ ## Overview
15
+
16
+ This dataset consists of a small subset of MongoDB's technical documentation.
17
+
18
+ ## Dataset Structure
19
+
20
+ The dataset consists of the following fields:
21
+
22
+ - sourceName: The source of the document.
23
+ - url: Link to the article.
24
+ - action: Action taken on the article.
25
+ - body: Content of the article in Markdown format.
26
+ - format: Format of the content.
27
+ - metadata: Metadata such as tags, content type etc. associated with the document.
28
+ - title: Title of the document.
29
+ - updated: The last updated date of the document.
30
+
31
+ ## Usage
32
+
33
+ This dataset can be useful for prototyping RAG applications. This is a real sample of data we have used to build the MongoDB Documentation Chatbot.
34
+
35
+ ## Ingest Data
36
+
37
+ To experiment with this dataset using MongoDB Atlas, first [create a MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register?utm_campaign=devrel&utm_source=community&utm_medium=organic_social&utm_content=Hugging%20Face%20Dataset&utm_term=apoorva.joshi).
38
+
39
+ You can then use the following script to load this dataset into your MongoDB Atlas cluster:
40
+
41
+ ```
42
+ import os
43
+ from pymongo import MongoClient
44
+ import datasets
45
+ from datasets import load_dataset
46
+ from bson import json_util
47
+
48
+
49
+ uri = os.environ.get('MONGODB_ATLAS_URI')
50
+ client = MongoClient(uri)
51
+ db_name = 'your_database_name' # Change this to your actual database name
52
+ collection_name = 'mongodb_docs'
53
+
54
+ collection = client[db_name][collection_name]
55
+
56
+ dataset = load_dataset("MongoDB/mongodb-docs")
57
+
58
+ insert_data = []
59
+
60
+ for item in dataset['train']:
61
+ doc = json_util.loads(json_util.dumps(item))
62
+ insert_data.append(doc)
63
+
64
+ if len(insert_data) == 1000:
65
+ collection.insert_many(insert_data)
66
+ print("1000 records ingested")
67
+ insert_data = []
68
+
69
+ if len(insert_data) > 0:
70
+ collection.insert_many(insert_data)
71
+ insert_data = []
72
+
73
+ print("Data ingested successfully!")
74
+ ```