search

Home  >  Q&A  >  body text

html - Populate in mongoose is useless?

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?

迷茫迷茫2789 days ago531

reply all(1)I'll reply

  • 阿神

    阿神2017-05-02 09:25:10

        Category.findOne({_id:id})
        .populate('lists')

    populate should be the field name

    reply
    0
  • Cancelreply