Content 数据模型 API 参考

Guage Lab 统一 Content 集合的字段定义、类型枚举和查询约束,供前后端联调参考。

知识库更新 · 2026-07-17

模型概览

所有内容(案例 / 实验室资源 / 知识文章 / 课程 / 思考)共用一个 Content MongoDB 集合,通过 type 字段区分。

字段定义

typescript
interface ContentItem {
type: "case" | "skill" | "knowledge" | "thinking" | "course";
slug: string; // 同 type 下唯一
title: string;
status: "draft" | "published" | "archived";
category?: string;
date?: string;
content: string; // Markdown
// ... 各类型专属字段
}

查询约束

  • 前台只读取 status: 'published'
  • 后台可读写所有状态
  • slug 只允许小写字母/数字/短横线

提交反馈

图文Content 数据模型 API 参考

0 / 2000