소스 정보
- 저장소
- ffsshhttiikk/opencode-agents-skills
- 최근 소스 활동
- 2026년 2월 28일 22:49
- 감지된 SKILL.md 언어
- 영어
- 스타
- 2
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/ffsshhttiikk/opencode-agents-skills --skill mongodb명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | mongodb |
| description | MongoDB document database management, aggregation pipelines, and data modeling |
| category | databases |
I am a leading NoSQL document database that stores data in flexible, JSON-like documents with dynamic schemas. I excel at handling unstructured and semi-structured data, providing horizontal scalability through sharding, and supporting rich query capabilities including full-text search, geospatial queries, and complex aggregations. I am designed for rapid development, scalability, and handling diverse data types in modern applications.
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
from datetime import datetime
client = MongoClient("mongodb://localhost:27017/")
db = client["app_database"]
def create_user(user_data):
user_doc = {
"email": user_data["email"],
"name": user_data["name"],
"password_hash": user_data["password_hash"],
"created_at": datetime.utcnow(),
"updated_at": datetime.utcnow(),
"profile": user_data.get("profile", {})
}
result = db.users.insert_one(user_doc)
return str(result.inserted_id)
def get_user_by_email(email):
return db.users.find_one({"email": email})
def get_user_with_orders(user_id):
from bson import ObjectId
user = db.users.find_one({"_id": ObjectId(user_id)})
if user:
user["orders"] = list(db.orders.find({"user_id": ObjectId(user_id)}).sort("created_at", -1))
return user
def update_user_profile(user_id, profile_updates):
from bson import ObjectId
result = db.users.update_one(
{: ObjectId(user_id)},
{: {**profile_updates, : datetime.utcnow()}}
)
result.modified_count >
():
bson ObjectId
db.client.start_session() session:
session.start_transaction():
db.orders.delete_many({: ObjectId(user_id)}, session=session)
result = db.users.delete_one({: ObjectId(user_id)}, session=session)
result.deleted_count >
from bson import ObjectId
from datetime import datetime, timedelta
def get_sales_analytics(start_date, end_date):
pipeline = [
{"$match": {"created_at": {"$gte": start_date, "$lte": end_date}}},
{"$group": {
"_id": {"$dateToString": {"format": "%Y-%m-%d", "date": "$created_at"}},
"total_orders": {"$sum": 1},
"total_revenue": {"$sum": "$total"},
"avg_order_value": {"$avg": "$total"},
"unique_customers": {"$addToSet": "$user_id"}
}},
{"$project": {
"date": "$_id",
"total_orders": 1,
"total_revenue": 1,
"avg_order_value": 1,
"unique_customers": {"$size": "$unique_customers"}
}},
{"$sort": {"date": 1}}
]
return list(db.orders.aggregate(pipeline))
def get_top_products():
pipeline = [
{: },
{: {
: ,
: {: },
: {: {: [, ]}}
}},
{: {
: ,
: ,
: ,
:
}},
{: },
{: {
: ,
: ,
:
}},
{: {: -}},
{: limit}
]
(db.order_items.aggregate(pipeline))
():
pipeline = [
{: {
: ,
: ,
: ,
:
}},
{: {
: ,
: ,
: {: },
: {: },
: {: }
}},
{: {
: {
: {
: [
{: {: [, ]}, : },
{: {: [, ]}, : },
{: {: [, ]}, : }
],
:
}
}
}}
]
(db.users.aggregate(pipeline))
():
pipeline = [
{: },
{: {
: ,
: ,
: ,
:
}},
{: },
{: {
: ,
: {: {: [, ]}},
: {: },
: {: }
}},
{: {: -}}
]
(db.orders.aggregate(pipeline))
from pymongo import ASCENDING, DESCENDING, TEXT
def create_product_indexes():
db.products.create_index([("name", TEXT), ("description", TEXT)], default_language="english")
db.products.create_index([("category", ASCENDING), ("price", DESCENDING)])
db.products.create_index([("SKU", ASCENDING)], unique=True)
db.products.create_index([("tags", ASCENDING)])
db.products.create_index([("created_at", DESCENDING)])
def search_products(query, filters=None):
search_filter = {"$text": {"$search": query}}
if filters:
if "min_price" in filters:
search_filter.setdefault("$and", []).append({"price": {"$gte": filters["min_price"]}})
if "max_price" in filters:
search_filter.setdefault("$and", []).append({"price": {"$lte": filters["max_price"]}})
if "category" in filters:
search_filter["category"] = filters["category"]
return db.products.find(
search_filter,
{"score": {"$meta": "textScore"}}
).sort("score", {"$meta": }).limit()
():
db.stores.find({
: {
: {
: {: , : location},
: max_distance_meters
}
}
})
():
operator = match_all
db.products.find({: {operator: tags}})
():
(db.products.aggregate([
{: {: {: threshold}}},
{: {
: ,
: ,
: ,
: ,
: {
: {: {: [, ]}, : , : }
}
}},
{: {: }}
]))
from bson import ObjectId
from pymongo.errors import BulkWriteError
def create_order_with_inventory_check(user_id, items, shipping_address):
with db.client.start_session() as session:
with session.start_transaction():
for item in items:
product = db.products.find_one({
"_id": item["product_id"],
"stock": {"$gte": item["quantity"]}
}, session=session)
if not product:
raise ValueError(f"Insufficient stock for product {item['product_id']}")
order_doc = {
"user_id": ObjectId(user_id),
"items": items,
"total": sum(item["quantity"] * item["price"] for item in items),
"status": "pending",
"shipping_address": shipping_address,
"created_at": datetime.utcnow()
}
order_result = db.orders.insert_one(order_doc, session=session)
for item in items:
db.products.update_one(
{"_id": item["product_id"]},
{"$inc": {"stock": -item[]}},
session=session
)
(order_result.inserted_id)
():
docs = []
product products:
docs.append({
: product[],
: product[],
: product[],
: product[],
: product.get(, ),
: product.get(, []),
: datetime.utcnow()
})
:
result = db.products.insert_many(docs, ordered=)
(result.inserted_ids)
BulkWriteError e:
e.details.get(, )
():
db.products.update_many(
{: category},
{: {: + price_change_percent / }}
).modified_count
():
pipeline = [
{: {: {: }}},
{: {
: {
: ,
: ,
: ,
:
}
}},
{: [, ]}
]
db.users.update_many(pipeline, {})
def create_store_location(name, address, coordinates):
db.stores.create_index([("location", "2dsphere")])
store_doc = {
"name": name,
"address": address,
"location": {"type": "Point", "coordinates": coordinates},
"hours": [
{"day": "Monday", "open": "09:00", "close": "21:00"},
{"day": "Tuesday", "open": "09:00", "close": "21:00"},
],
"services": ["pickup", "delivery", "installation"]
}
return db.stores.insert_one(store_doc).inserted_id
def search_stores_with_services(services):
return db.stores.find({"services": {"$all": services}})
def get_orders_with_multiple_items(min_items=3):
return db.orders.find({"$expr": {"$gte": [{"$size": "$items"], min_items]}})
def get_popular_tags():
return list(db.products.aggregate([
{"$unwind": },
{: {: , : {: }}},
{: {: -}},
{: }
]))
():
pipeline = [
{: {: ObjectId(user_id), : }},
{: },
{: {
: ,
: ,
: ,
:
}},
{: },
{: {
: ,
: {: {
: ,
: ,
:
}},
: {: {: [, ]}}
}}
]
(db.carts.aggregate(pipeline))