Mongoose多个嵌套选择

时间:2015-10-22 10:57:52

标签: javascript node.js mongodb mongoose

我正在尝试使用多个嵌套选择器将select放在一个大型查询上,例如:

 .select('parent.0.item parent.0.item2 other item');

然而,从不选择父数组中的第二项,只返回第一项。和建议?

2 个答案:

答案 0 :(得分:1)

发现我只是删除了“.0”,并将其写成:

$model->fill(array(fields...))->save()

答案 1 :(得分:0)

在Mongoose版本4中,您不需要使用select(),如下所示

import CoreLocation
祝你好运

相关问题