parse-community / parse-community/parse-server

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

Open
#9,143 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading MongoStorageAdapter and the batch endpoint handler in src/batch.js, especially the createObject path and how Parse.Object.saveAll requests are processed. Compare the existing updateMany and deleteMany usage with new-document handling, then verify that large saveAll calls use Mongo's bulk insertion behavior and preserve the expected request semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.