English 中文(简体)
是否对ongo子进行了检查?
原标题:does mongoose have an isDirty check?

我要说的是,布洛奇语的布洛卡语含有embedded语。 评论可由原出版商和编辑/行政编辑编辑编辑。 在增加/编辑评论后,整个博客台得以节省。

我有某些习俗,即对根深蒂固的评论-意见进行预先的中层认识,这些评论自动确定了该特定意见的最后日期。

The thing is that pre is called on EVERY comment on the blogpost, since I call save() on the blogpost. (For other reasons I need to do it like this) . Therefore, I need a way to check which comments have changed (or are new) since they were last saved (as part of the Blogpost overall save())

寻求:在评论是否改变之前如何检查? 印本 仅够了,因为评论也可以加以编辑(即:无新意)。

是否有任何<代码>isDirty或类似于I m过上?

最佳回答

2. 您可使用经修改的电梯:

if (doc.modified) {
   // :)
}
问题回答

版本3.x

if(doc.isModified()){
  // do stuff
}




相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

热门标签