Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple group stage issue in aggregation pipeline #6068

Open
ssafayet opened this issue Sep 20, 2019 · 3 comments
Open

Multiple group stage issue in aggregation pipeline #6068

ssafayet opened this issue Sep 20, 2019 · 3 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@ssafayet
Copy link
Contributor

Issue Description

Parse aggregation pipeline is throwing error on multiple group by. If the first group stage is based on a pointer field and second group stage is based on the number field then it is throwing error.

Steps to reproduce

var pipeline = [ { group: { objectId: '$user', totalScore: { $sum: '$score' } } }, { group: { objectId: '$totalScore', users: { $push: { userId: "$_id" } } } }, { sort: {objectId: -1}} ];

Expected Results

[ { "users": [ { "userId": "_User$odInwXlX1B" } ], "objectId": 50 }, { "users": [ { "userId": "_User$bnhHc22tfl" } ], "objectId": 10 } ]

Actual Outcome

Uncaught internal server error.result._id.split is not a function on line /node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js:596:15

Environment Setup

  • Server

    • parse-server version : 3.1.3
    • Operating System: Ubuntu 18.04
    • Hardware: Intel 4th Gen (2.2 Ghz) Dual Core, 16 GB Ram.
    • Localhost or remote server? : localhost
  • Database

    • MongoDB version: 3.6
    • Storage engine: WiredTiger
    • Hardware: Same as the previous
    • Localhost or remote server? : localhost

My Observation

On the second group stage, result._id is a number but storage adapter is trying to split it. And the reason it is trying to split it because isPointerField is being set as true due to the first group stage.

@davimacedo davimacedo added type:bug Impaired feature or lacking behavior that is likely assumed needs investigation labels Sep 20, 2019
@ssafayet
Copy link
Contributor Author

@davimacedo Hi! Any update regarding this issue?

@ssafayet
Copy link
Contributor Author

Hello @dplewis , Can you kindly look into this issue? If you can guide me on how to solve this issue then I can submit a PR.

@dplewis
Copy link
Member

dplewis commented Oct 28, 2019

I should have some time this week to look into it. In the meantime you can get started with the following.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants