我有一個300k的測驗檔案集。我想把所有人的firstName和lastName都更新為小寫。
const person = new Schema( {
firstName: { type: String}。
lastName: { type: String }。
})
我已經將lowecase:true添加到模式中,但我如何更新現有的檔案?
我試過:
CaseFile。
.find({ })
.cursor()
.eachAsync(async function (doc) {
await doc.save()
})
但我得到了錯誤
Error: Collection method find is synchronous
我也試過 :
CaseFile。
.find({ })
.then(docs => {
docs.forEach(doc => {
doc.save()
})
})
這就出現了錯誤:
這就出現了錯誤。
JavaScript heap out of memory
db版本v5.0.2
"mongoose"。"^6.0.5",
感謝Wernfried Domscheit提供的管道。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/319832.html
標籤:
上一篇:在嘗試安裝字體真棒時出現錯誤
下一篇:如何禁用資料采集器中的星期一?
