File size: 2,144 Bytes
62dfdfb
 
e4c054b
 
 
 
 
 
 
 
 
62dfdfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05c49c2
62dfdfb
 
 
 
 
05c49c2
 
 
62dfdfb
 
05c49c2
62dfdfb
 
 
 
05c49c2
62dfdfb
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
license: cc-by-3.0
task_categories:
- question-answering
language:
- en
tags:
- vector search
- retrieval augmented generation
size_categories:
- <1K
---

## Overview

This dataset consists of ~600 articles from the MongoDB Developer Center.

## Dataset Structure

The dataset consists of the following fields: 

- sourceName: The source of the article. This value is `devcenter` for the entire dataset.
- url: Link to the article
- action: Action taken on the article. This value is `created` for the entire dataset.
- body: Content of the article in Markdown format
- format: Format of the content. This value is `md` for all articles.
- metadata: Metadata such as tags, content type etc. associated with the articles
- title: Title of the article
- updated: The last updated date of the article

## Usage

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.  

## Ingest Data

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).

You can then use the following script to load this dataset into your MongoDB Atlas cluster:

```
import os
from pymongo import MongoClient
import datasets
from datasets import load_dataset
from bson import json_util


uri = os.environ.get('MONGODB_ATLAS_URI')
client = MongoClient(uri)
db_name = 'your_database_name'  # Change this to your actual database name
collection_name = 'devcenter_articles'

collection = client[db_name][collection_name]

dataset = load_dataset("MongoDB/devcenter-articles")

insert_data = []

for item in dataset['train']:
    doc = json_util.loads(json_util.dumps(item))
    insert_data.append(doc)

    if len(insert_data) == 1000:
        collection.insert_many(insert_data)
        print("1000 records ingested")
        insert_data = []

if len(insert_data) > 0:
    collection.insert_many(insert_data)
    insert_data = []

print("Data ingested successfully!")
```