Skip to content

saveAll should use Mongo's insertMany method for bulk saving new documents #9143

Open
@pocketcolin

Description

@pocketcolin

New Feature / Enhancement Checklist

Current Limitation

Unless I'm misreading the code, it appears that under the hood the Parse.Object.saveAll method is making many synchronous requests instead of batching them together into a single atomic Bulk request. I see in the MongoStorageAdapter that Parse uses updateMany and even deleteMany, but I don't see insertMany anywhere and the only create function appears to be createObject (singular). The batch endpoint handler also appears to be running the requests separately (here). Please let me know if I'm missing something that we are actually inserting documents in bulk!

Feature / Enhancement Description

By leveraging Mongo's native insert bulk function, we'd reduce number of connections and speed up large requests.

Example Use Case

I need to insert 1000 new documents but want the inserts to happen as close to simultaneously as possible.

Alternatives / Workarounds

Using the Mongo driver directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions