Skip to content

Commit

Permalink
fix: validate:model memory heap (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
moroine authored Oct 18, 2023
1 parent 2b609c6 commit 66138bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/jobs/database/validateModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import { Pagination } from "@/common/model/schema/_shared/mongoose-paginate"

async function validateModel<T>(model: Model<T> | Pagination<T>, z: ZodType<T, any, any>) {
const collectionName = model.collection.name
const cursor = await model.find({}).lean()
const cursor = model.find({}).lean()

let totalCount = 0
let count = 0
const errorStats: Record<string, number> = {}
for (const doc of cursor) {
for await (const doc of cursor) {
try {
totalCount++
z.parse(doc)
Expand Down

0 comments on commit 66138bd

Please sign in to comment.