[COMPASS-4263] Importing a new pipeline from text with a $out crashes Compass completely Created: 30/Apr/20  Updated: 29/Oct/23  Resolved: 02/Jul/20

Status: Closed
Project: Compass
Component/s: Aggregation pipeline
Affects Version/s: 1.21.0
Fix Version/s: 1.23.0

Type: Bug Priority: Blocker - P1
Reporter: Maxime Beugnet Assignee: Alena Khineika
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 10


Sprint: Iteration Dragon Fruit, Iteration Elderberry, Iteration Fig, Iteration Guanábana

 Description   

You can reproduce yourself.

  • Connect here:

mongodb+srv://readonly:readonly@covid-19.hip2i.mongodb.net/covid19

 

  • Go to collection covid19.statistics > Aggregation tab.
  • Try to import the following pipeline with the $out at the end. The same pipeline without the $out doesn't cause the problem.

[
        {
            '$group': {
                '_id': {
                    'country': '$country',
                    'date': '$date'
                },
                'uids': {
                    '$addToSet': '$uid'
                },
                'country_iso2s': {
                    '$addToSet': '$country_iso2'
                },
                'country_iso3s': {
                    '$addToSet': '$country_iso3'
                },
                'country_codes': {
                    '$addToSet': '$country_code'
                },
                'combined_names': {
                    '$addToSet': '$combined_name'
                },
                'population': {
                    '$first': '$population'
                },
                'confirmed': {
                    '$sum': '$confirmed'
                },
                'deaths': {
                    '$sum': '$deaths'
                },
                'recovered': {
                    '$push': '$recovered'
                },
                'states': {
                    '$push': '$state'
                }
            }
        }, {
            '$project': {
                '_id': 0,
                'country': '$_id.country',
                'date': '$_id.date',
                'uids': 1,
                'country_iso2s': {
                    '$cond': [
                        {
                            '$eq': [
                                '$country_iso2s', null
                            ]
                        }, '$$REMOVE', '$country_iso2s'
                    ]
                },
                'country_iso3s': {
                    '$cond': [
                        {
                            '$eq': [
                                '$country_iso3s', null
                            ]
                        }, '$$REMOVE', '$country_iso3s'
                    ]
                },
                'country_codes': {
                    '$cond': [
                        {
                            '$eq': [
                                '$country_codes', null
                            ]
                        }, '$$REMOVE', '$country_codes'
                    ]
                },
                'combined_names': {
                    '$cond': [
                        {
                            '$eq': [
                                '$combined_names', null
                            ]
                        }, '$$REMOVE', '$combined_names'
                    ]
                },
                'population': {
                    '$cond': [
                        {
                            '$eq': [
                                '$population', null
                            ]
                        }, '$$REMOVE', '$population'
                    ]
                },
                'confirmed': 1,
                'deaths': 1,
                'recovered': {
                    '$cond': [
                        {
                            '$eq': [
                                '$recovered', []
                            ]
                        }, '$$REMOVE', {
                            '$sum': '$recovered'
                        }
                    ]
                },
                'states': {
                    '$cond': [
                        {
                            '$eq': [
                                '$states', []
                            ]
                        }, '$$REMOVE', '$states'
                    ]
                }
            }
        }, {
            '$out': "countries_summary_temp"
        }
    ]


Generated at Wed Feb 07 22:35:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.