five

MongoDB/product-catalog

收藏
Hugging Face2024-06-04 更新2024-06-29 收录
下载链接:
https://hf-mirror.com/datasets/MongoDB/product-catalog
下载链接
链接失效反馈
官方服务:
资源简介:
--- license: apache-2.0 --- ## Ingest Data The small script `ingest.py` can be used to load the data into your MongoDB Atlas cluster. ``` pip install pymongo pip install datasets ## export MONGODB_ATLAS_URI=<your atlas uri> ``` The `ingest.py`: ```python 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 = 'ai_shop' collection_name = 'products' product_collection = client[db_name][collection_name] dataset = load_dataset("MongoDB/product-catalog") insert_data = [] for product in dataset['train']: doc_product = json_util.loads(json_util.dumps(product)) insert_data.append(doc_product) if len(insert_data) == 1000: product_collection.insert_many(insert_data) print("1000 records ingested") insert_data = [] if len(insert_data) > 0: product_collection.insert_many(insert_data) insert_data = [] print("Data Ingested") ``` ## Contact For any queries or further information regarding this dataset, please open a disucssion.

The dataset named `MongoDB/product-catalog` contains product information and is used to store in the `products` collection of the `ai_shop` database in MongoDB.
提供机构:
MongoDB
5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作