html - Populate in mongoose is useless?
迷茫
迷茫 2017-05-02 09:23:10
0
1
523

This is the background code. There is no problem with the item value obtained, but the value in item.lists is still id. When traversing item.lists in jade, all the values ​​obtained are null values, that is, in item.lists What is saved is still the objectId, not the data associated with populate.


Here are the schemas of mongoose.


There is no problem with foreign keys.
Excuse me, what is going on?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
阿神
    Category.findOne({_id:id})
    .populate('lists')

populate should be the field name

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template