【问题标题】:Is exexPopulate() method is deprecated from the mongoose new version?猫鼬新版本是否已弃用 exexPopulate() 方法?
【发布时间】:2021-11-15 14:43:20
【问题描述】:
main()

    const main = async () =>{
    const task = await Task.findById('614ac31e103d9c5329d38686')
    await task.populate('owner').execPopulate()
    console.log(task.owner)
}

execPopulate() 不是函数

【问题讨论】:

    标签: mongoose mongodb-query mongoose-schema mongoose-populate mongoose-plugins


    【解决方案1】:

    来自https://mongoosejs.com/docs/migrating_to_6.html#removed-execpopulate 的更新日志,

    该行应替换为

    await task.populate('owner')
    

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 1970-01-01
      • 2015-09-19
      • 1970-01-01
      • 2014-08-29
      • 1970-01-01
      • 1970-01-01
      • 2013-06-29
      • 1970-01-01
      相关资源
      最近更新 更多