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.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 #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:
parse-server/src/Adapters/Storage/Mongo/MongoStorageAdapter.js
Lines 586 to 587 in fe02d3e
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 #8787.