CNode

Mongoose里model和entity的区别

问答
Ttweyseo发布于12 年前最后回复12 年前6 回复8547 浏览0 收藏

entity是model生成的实例 可是两者都可对数据库操作造成影响 所以不大不明白两者之间有什么区别 就是什么时候用entity 什么时候用model

查看回复

回复 (6)

R
ravenwang#1·12 年前

model对应collection,entity(document?)对应collection中的document

A
alsotang#2·12 年前

操作数据的默认用 model,entity 只能操作自己。

T
tweyseo#3·12 年前
引用 ravenwangmodel对应collection,entity(document?)对应collection中的document

@ravenwang 意思就是model操作表 entity操作记录?

T
tweyseo#5·12 年前
引用 ravenwang@tweyseo 差不多这个意思

@ravenwang thx a lot

X
xiuxu123#6·12 年前

你看下这篇文章,这个里面有很详细的说明, https://cnodejs.org/topic/504b4924e2b84515770103dd

参与回复
登录后即可参与回复。登录