gpt4 book ai didi

performance - 与填充一起使用时 Mongoose 查询性能低下

转载 作者:行者123 更新时间:2023-12-02 03:03:29 25 4
gpt4 key购买 nike

我需要有关此查询的帮助。我正在 AppVisitor 中查询 8000 个文档,其中填充了 4 个集合。但它没有返回任何结果。意味着它卡住了,一段时间后,nodejs 服务器为执行此查询的路由返回 404 错误。

 let Keys = yield AppVisitor.find(condition).sort({ createdAt: -1 })
.populate({ path: 'userDeatils' })
.populate({ path: 'details' })
.populate({
path: 'skills',
match: {
$and: [{ value: { $ne: '' } }, { value: { $ne: null } }, { value: { $not: /({R[\d]+})/g } }]
}
})
.populate({ path: 'courses' });

最佳答案

我想尝试重组您的集合可能会有所帮助,并减少使用 populate 函数,因为它是一项繁重的操作。确保您在使用 populate 时知道自己在做什么。

关于performance - 与填充一起使用时 Mongoose 查询性能低下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44334577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com