如何在填充的数组中保留空值?

时间:2016-01-26 14:19:54

标签: node.js mongodb mongoose mongoose-populate

我有像这样的猫鼬文件:

{
    _id: ObjectId("56a5ddb76c9248f30746a425"),
    people: [
        null,
        null,
        null,
        null,
        ObjectId("56a5dd816c9248f30746a420"),
        null,
        null,
        ObjectId("56a5ddae6c9248f30746a424"),
        ObjectId("56a5dd6c6c9248f30746a41e"),
        ObjectId("56a4d6652cc5cd631b6f3255"),
        ObjectId("56a5ddb76c9248f30746a425"),
        null
    ]
}

当我执行doc.populate("people")时,people数组只包含五个元素,但我需要保留这些空值。我该怎么做?

0 个答案:

没有答案