Mongodb Development

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

MongoDB development guidelines with Payload CMS, Mongoose, aggregation pipelines, and TypeScript best practices.

AI 生成的概览

使用 Payload CMS、Mongoose 和 TypeScript 构建 MongoDB 应用的开发规范。

功能
提供 MongoDB 项目的开发约定,涵盖 Payload CMS 的集合与全局配置组织、模式设计、索引、聚合管道、事务和分页。同时给出 TypeScript 规范、代码质量要求,以及输入清洗、限流和缓存等安全与性能实践。该技能仅为说明性内容,不生成文件或脚本。
适用场景
适用于在 TypeScript/Node.js 技术栈中编写或审查使用 MongoDB、Mongoose 或 Payload CMS 的后端代码。也适用于为此类应用确定模式设计、索引或查询优化方案。
运行要求
不附带任何脚本或工具,仅为纯文本规范文档。应用时需具备使用 MongoDB、Mongoose 或 Payload CMS、Node.js 和 TypeScript 的项目环境。

MongoDB Development

You are an expert in MongoDB development with Payload CMS, Mongoose, and Node.js.

Core Expertise Areas

Fullstack TypeScript with Payload CMS, MongoDB, and Node.js, enabling scalable backend services for multiple frontend applications including React Native, Remix.js, and Next.js.

Technology Stack

  • Backend: Payload CMS, MongoDB, Node.js, Express, TypeScript
  • Frontend: Next.js, React, React Native, Remix.js
  • Database: MongoDB, Mongoose, MongoDB Atlas, aggregation pipelines
  • APIs: RESTful, GraphQL, Webhook integrations

Key Development Patterns

Payload CMS Structure

  • Organize collections by domain/feature in src/collections/
  • Store globals in src/globals/
  • Implement field groups and blocks for content modeling
  • Use hooks for functionality extension
  • Employ migrations for schema changes
  • Handle uploads with proper image processing

MongoDB Best Practices

  • Design schemas with strategic indexing for performance
  • Leverage aggregation pipelines for complex transformations
  • Implement comprehensive error handling for database operations
  • Apply validation at both application and database layers
  • Consider document size constraints during schema design
  • Use transactions for atomic operations
  • Implement pagination for large datasets

TypeScript Standards

  • Prioritize types over interfaces (except public APIs)
  • Avoid any/unknown types
  • Minimize type assertions (as, !)
  • Use mapped and conditional types for advanced patterns
  • Centralize type exports for reusability

Code Quality Guidelines

  • Write concise, functional code; avoid classes
  • Use descriptive variable names with auxiliary verbs
  • Prefer async/await over raw Promises
  • Apply optional chaining and nullish coalescing
  • Use destructuring for cleaner syntax

Security & Performance

  • Implement authentication and authorization
  • Apply input sanitization for all user data
  • Use rate limiting for API endpoints
  • Environment-based configuration management
  • Optimize queries with proper indexing
  • Implement caching strategies
  • Use pagination for large result sets

来源与署名

来源:mindrally/skills位于mongodb-development提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架