databases by mrgoonie/claudekit-skills
npx skills add https://github.com/mrgoonie/claudekit-skills --skill databases适用于 MongoDB(面向文档)和 PostgreSQL(关系型)数据库的统一指南。根据您的用例选择合适的数据库,并精通这两个系统。
在以下情况下使用:
最适合: 内容管理、目录、物联网时间序列、实时分析、移动应用、用户档案
最适合: 金融系统、电子商务交易、ERP、CRM、数据仓库、分析
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# Atlas(云)- 推荐
# 1. 在 mongodb.com/atlas 注册
# 2. 创建 M0 免费集群
# 3. 获取连接字符串
# 连接
mongodb+srv://user:pass@cluster.mongodb.net/db
# Shell
mongosh "mongodb+srv://cluster.mongodb.net/mydb"
# 基本操作
db.users.insertOne({ name: "Alice", age: 30 })
db.users.find({ age: { $gte: 18 } })
db.users.updateOne({ name: "Alice" }, { $set: { age: 31 } })
db.users.deleteOne({ name: "Alice" })
# Ubuntu/Debian
sudo apt-get install postgresql postgresql-contrib
# 启动服务
sudo systemctl start postgresql
# 连接
psql -U postgres -d mydb
# 基本操作
CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT, age INT);
INSERT INTO users (name, age) VALUES ('Alice', 30);
SELECT * FROM users WHERE age >= 18;
UPDATE users SET age = 31 WHERE name = 'Alice';
DELETE FROM users WHERE name = 'Alice';
// MongoDB
db.users.insertOne({ name: "Bob", email: "bob@example.com" })
db.users.insertMany([{ name: "Alice" }, { name: "Charlie" }])
-- PostgreSQL
INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');
INSERT INTO users (name, email) VALUES ('Alice', NULL), ('Charlie', NULL);
// MongoDB
db.users.find({ age: { $gte: 18 } })
db.users.findOne({ email: "bob@example.com" })
-- PostgreSQL
SELECT * FROM users WHERE age >= 18;
SELECT * FROM users WHERE email = 'bob@example.com' LIMIT 1;
// MongoDB
db.users.updateOne({ name: "Bob" }, { $set: { age: 25 } })
db.users.updateMany({ status: "pending" }, { $set: { status: "active" } })
-- PostgreSQL
UPDATE users SET age = 25 WHERE name = 'Bob';
UPDATE users SET status = 'active' WHERE status = 'pending';
// MongoDB
db.users.deleteOne({ name: "Bob" })
db.users.deleteMany({ status: "deleted" })
-- PostgreSQL
DELETE FROM users WHERE name = 'Bob';
DELETE FROM users WHERE status = 'deleted';
// MongoDB
db.users.createIndex({ email: 1 })
db.users.createIndex({ status: 1, createdAt: -1 })
-- PostgreSQL
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_users_status_created ON users(status, created_at DESC);
scripts/ 目录中的数据库实用脚本:
# 生成迁移
python scripts/db_migrate.py --db mongodb --generate "add_user_index"
# 运行备份
python scripts/db_backup.py --db postgres --output /backups/
# 检查性能
python scripts/db_performance_check.py --db mongodb --threshold 100ms
| 功能 | MongoDB | PostgreSQL |
|---|---|---|
| 数据模型 | 文档(JSON/BSON) | 关系型(表/行) |
| 模式 | 灵活、动态 | 严格、预定义 |
| 查询语言 | MongoDB 查询语言 | SQL |
| 连接 | $lookup(有限) | 原生、优化 |
| 事务 | 多文档(4.0+) | 原生 ACID |
| 扩展 | 水平(分片) | 垂直(主)、水平(扩展) |
| 索引 | 单字段、复合、文本、地理空间等 | B-tree、hash、GiST、GIN 等 |
MongoDB:
PostgreSQL:
每周安装次数
212
代码仓库
GitHub 星标数
1.9K
首次出现
2026年1月22日
安全审计
安装于
opencode164
claude-code163
gemini-cli161
codex154
cursor142
github-copilot134
Unified guide for working with MongoDB (document-oriented) and PostgreSQL (relational) databases. Choose the right database for your use case and master both systems.
Use when:
Best for: Content management, catalogs, IoT time series, real-time analytics, mobile apps, user profiles
Best for: Financial systems, e-commerce transactions, ERP, CRM, data warehousing, analytics
# Atlas (Cloud) - Recommended
# 1. Sign up at mongodb.com/atlas
# 2. Create M0 free cluster
# 3. Get connection string
# Connection
mongodb+srv://user:pass@cluster.mongodb.net/db
# Shell
mongosh "mongodb+srv://cluster.mongodb.net/mydb"
# Basic operations
db.users.insertOne({ name: "Alice", age: 30 })
db.users.find({ age: { $gte: 18 } })
db.users.updateOne({ name: "Alice" }, { $set: { age: 31 } })
db.users.deleteOne({ name: "Alice" })
# Ubuntu/Debian
sudo apt-get install postgresql postgresql-contrib
# Start service
sudo systemctl start postgresql
# Connect
psql -U postgres -d mydb
# Basic operations
CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT, age INT);
INSERT INTO users (name, age) VALUES ('Alice', 30);
SELECT * FROM users WHERE age >= 18;
UPDATE users SET age = 31 WHERE name = 'Alice';
DELETE FROM users WHERE name = 'Alice';
// MongoDB
db.users.insertOne({ name: "Bob", email: "bob@example.com" })
db.users.insertMany([{ name: "Alice" }, { name: "Charlie" }])
-- PostgreSQL
INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');
INSERT INTO users (name, email) VALUES ('Alice', NULL), ('Charlie', NULL);
// MongoDB
db.users.find({ age: { $gte: 18 } })
db.users.findOne({ email: "bob@example.com" })
-- PostgreSQL
SELECT * FROM users WHERE age >= 18;
SELECT * FROM users WHERE email = 'bob@example.com' LIMIT 1;
// MongoDB
db.users.updateOne({ name: "Bob" }, { $set: { age: 25 } })
db.users.updateMany({ status: "pending" }, { $set: { status: "active" } })
-- PostgreSQL
UPDATE users SET age = 25 WHERE name = 'Bob';
UPDATE users SET status = 'active' WHERE status = 'pending';
// MongoDB
db.users.deleteOne({ name: "Bob" })
db.users.deleteMany({ status: "deleted" })
-- PostgreSQL
DELETE FROM users WHERE name = 'Bob';
DELETE FROM users WHERE status = 'deleted';
// MongoDB
db.users.createIndex({ email: 1 })
db.users.createIndex({ status: 1, createdAt: -1 })
-- PostgreSQL
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_users_status_created ON users(status, created_at DESC);
Database utility scripts in scripts/:
db_migrate.py - Generate and apply migrations for both databases
db_backup.py - Backup and restore MongoDB and PostgreSQL
db_performance_check.py - Analyze slow queries and recommend indexes
python scripts/db_migrate.py --db mongodb --generate "add_user_index"
python scripts/db_backup.py --db postgres --output /backups/
python scripts/db_performance_check.py --db mongodb --threshold 100ms
| Feature | MongoDB | PostgreSQL |
|---|---|---|
| Data Model | Document (JSON/BSON) | Relational (Tables/Rows) |
| Schema | Flexible, dynamic | Strict, predefined |
| Query Language | MongoDB Query Language | SQL |
| Joins | $lookup (limited) | Native, optimized |
| Transactions | Multi-document (4.0+) | Native ACID |
| Scaling | Horizontal (sharding) | Vertical (primary), Horizontal (extensions) |
| Indexes | Single, compound, text, geo, etc | B-tree, hash, GiST, GIN, etc |
MongoDB:
PostgreSQL:
Weekly Installs
212
Repository
GitHub Stars
1.9K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode164
claude-code163
gemini-cli161
codex154
cursor142
github-copilot134
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
130,600 周安装
小红书自动化控制工具 - 使用Playwright实现内容发布、搜索、评论等自动化操作
106 周安装
PostgreSQL只读查询技能 - 安全数据库连接与数据分析工具
106 周安装
RealityKit API 参考手册 - 按类别整理的完整 AR 开发指南
107 周安装
阿里云函数计算FC Serverless Devs技能测试指南 - 冒烟测试与部署验证
107 周安装
阿里云Data Analytics DataAnalysisGBI技能冒烟测试指南 - 云数据分析测试实践
107 周安装
阿里云技能创建器 - 专为alicloud-skills仓库设计的技能工程工作流工具
107 周安装