|
You can reproduce yourself.
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"
|
}
|
]
|
|