parse-community / parse-community/parse-server

Officially expose MongoDB client

Open
#8,786 4 comments 0 reactions 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

Parse Server uses a richer interface to interact with the database than it exposes for developers to use. For example upserting (upsertOneObject), mass-updating by query (updateObjectsByQuery) or findOneAndUpdate. These are currently only accessible via:

  • the internal database adapter, for example Parse.Server.database.adapter.findOneAndUpdate
  • the higher level Parse.Server.database.update which adds some convenience, like supplying the schema for the target class and transforming high-level Parse references to raw MongoDB references

Given these method's versatility and efficiency, we can assume that they are widely in use. Especially since the Parse Server configuration has been made more accessible with Parse.Server in https://github.com/parse-community/parse-server/issues/7869.

As an example for efficiency consider the case of upserting an object:

  • With he public interface an upsert requires 1 unique index, 1 write request, catching the error if the object exists and then 1 update request.
  • With the internal interface an upsert requires 1 upsert upsertOneObject request.

However, these methods are all internal. Changing them would not be considered breaking changes and it wouldn't even be in the changelog. It is even suggested that they may be removed if possible:

https://github.com/parse-community/parse-server/blob/fe02d3e8aa875f362377cc877a65831b010b00a6/src/Adapters/Storage/Mongo/MongoStorageAdapter.js#L586-L587

Feature / Enhancement Description

Parse Server should officially expose a method in Cloud Code similar to the Parse.Server.database.update method. Exposing Parse.Server.database.update directly would likely be unpractical, since the method is not well structured in its design and is used internally throughout the code. It could be available in Cloud Code via something like await Parse.Cloud.Database.execute({ ... }).

Availability in the Parse JS SDK is out of scope for this feature, see also https://github.com/parse-community/parse-server/issues/8787.

Example Use Case

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 Parse.Server.database.update and the MongoStorageAdapter reference around src/Adapters/Storage/Mongo/MongoStorageAdapter.js#L586-L587. Review how existing database operations are used internally and the linked issue 4258 use case. Done means agreeing on and implementing an official Cloud Code database execution interface, with coverage for the supported operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
api, backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.