Skip to content

Support native mongodb syntax for aggregation pipelines #7338

Closed
@RaschidJFR

Description

@RaschidJFR

New Feature / Enhancement Checklist

Current Limitation

In the JS SDK Parse.Query.aggregate() works really well in runtime, but the fact that stage names differ from the built-in MongoDB’s by the $ symbol and using objectId instead of _id represents an issue for compatibility, for example, when importing/exporting/debugging a pipeline in other tools like MongoCompass.

Feature / Enhancement Description

Parse.Query.aggregate() should support pipeline stage names in the same format as in mongodb so pipelines can be copy-pasted from/to other tools (mongo shell, mongo compass, etc), without having to edit each stage's name.

Example Use Case

Either of these parameters should be valid:

// current Parse SDK format
Parse.Query.aggregate({ match: { objectId: '1234' } });
// mongodb's standard format
Parse.Query.aggregate({ $match: { _id: '1234' } });

Alternatives / Workarounds

A current workaround is to develop/test/debug pipelines in MongoDB Compass (or your preferred tool) and then copy the whole pipeline into your js code and edit all stage names (only top-level, btw) by adding a preceding $ and substituting _id for objectId on top-level stages (2nd-level stages and deeper are already using _id).

3rd Party References

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