parse-community / parse-community/parse-server
Officially expose MongoDB client
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
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.updatewhich 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
upsertOneObjectrequest.
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:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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