Aggregation Structure and Syntax

Hi There,

When i’ve tried to execute the following command which is provided in the “aggregation_structure.js” handout, i’ve got the following error.

command(pipeline):
db.solarSystem.aggregate([{
“$match”: {
“atmosphericComposition”: { “$in”: [/O2/] },
“meanTemperature”: { $gte: -40, “$lte”: 40 }
}
}, {
“$project”: {
“_id”: 0,
“name”: 1,
“hasMoons”: { “$gt”: ["$numberOfMoons", 0] }
}
}], { “allowDiskUse”: true});

Error:
image

Please help me out to execute this.

Hi,

It looks like you are trying to access a solarSytem collection in a solarSystem database, which is not correct. Please note that the solarSystem collection is in the aggregations database.

José Carlos