Skip to content

bulkSave promise result, updateResult.getWriteErrorCount is not a function #15314

Closed
@kYem

Description

@kYem

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.8.2

Node.js version

20.18.3

MongoDB server version

6.10.0

Typescript version (if applicable)

5.5.4

Description

This seems to only happen from time to time, maybe cause we are sending a large list of updates, potentially (1-5100) updates in bulk save.

    const updateResult = await TrackerValue.bulkSave(toUpdateValues);
   // Error updateResult.getWriteErrorCount is not a function
    result.failCount = updateResult.getWriteErrorCount();
    result.success = true;
    return result;

Steps to Reproduce

Unfortunately not easy way to produce. Will try to create separate isolated case, but hopefully even without it would be easy to narrow down when getWriteErrorCount is not a function

Expected Behavior

Should either throw error or TypeScrip types are not correct, as getWriteErrorCount is not always available?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions