且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在猫鼬的嵌入式文档中更新嵌入式文档?

更新时间:2021-11-17 07:16:23

自解决以来的问题. Aaron Heckmann在猫鼬Google Group :

Problem since solved. I was given the answer by Aaron Heckmann over on the mongoose Google Group:

在将子模式传递给父模式之前,始终先对其进行声明,否则将传递未定义的子模式.

Always declare your child schemas before passing them to you parent schemas otherwise you are passing undefined.

SubCommentSchema应该是第一个,然后是Comment,然后是BlogPost.

SubCommentSchema should be first, then Comment followed by BlogPost.

在反转了模式之后,它起作用了.

After reversing the schemas it worked.