知识卡片
存储模型与接口投影
外部对象保护消费者所见,内部对象解决持久化。建立显式投影可将 _id 对外改成 id,只返回必要字段并处理日期或标识转换。对外已稳定后,更换数据库优先保持契约。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Building a backend with Node.js and Swagger Codegen 13.6 Database persistence with Mongoose · 查看原书依据
We created the domain model based on the outside view of the application and with the purpose of designing an API. However, we also need an internal domain model to represent the resources inside the database. It is crucial to understand that
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第13章《Building a backend with Node.js and Swagger Codegen》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch13.htm,阅读块 193)
- 结论依据:原文说明内外模型使用同一领域语言但类型与属性不必相同。
- 原始内容:We created the domain model based on the outside view of the application and with the purpose of designing an API. However, we also need an internal domain model to represent the resources inside the database. It is crucial to understand that