Body
-
The name of a linked MongoDB Atlas data source. This is commonly
"mongodb-atlas"
though it may be different in your App if you chose a different name when you created the data source. -
The name of a database in the specified data source.
-
The name of a collection in the specified database.
-
An array of aggregation stages.
A MongoDB aggregation stage. For a list of all aggregation stages that the Data API supports, see Aggregation Pipeline Stage Availability.
A MongoDB aggregation stage. For a list of all aggregation stages that the Data API supports, see Aggregation Pipeline Stage Availability.
Body
-
The name of a linked MongoDB Atlas data source. This is commonly
"mongodb-atlas"
though it may be different in your App if you chose a different name when you created the data source. -
The name of a database in the specified data source.
-
The name of a collection in the specified database.
-
An array of aggregation stages.
A MongoDB aggregation stage. For a list of all aggregation stages that the Data API supports, see Aggregation Pipeline Stage Availability.
A MongoDB aggregation stage. For a list of all aggregation stages that the Data API supports, see Aggregation Pipeline Stage Availability.
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/aggregate" \
-X POST \
-H "apiKey: $API_KEY" \
-H 'Content-Type: application/ejson' \
-H "Accept: application/json" \
-d '{
"dataSource": "mongodb-atlas",
"database": "learn-data-api",
"collection": "tasks",
"pipeline": [
{
"$match": { "status": "complete" }
},
{
"$group": {
"_id": "$status",
"count": { "$sum": 1 },
"tasks": { "$push": "$text" }
}
},
{
"$sort": { "count": -1 }
}
]
}'
[
{
"$groupBy": {
"_id": "$status",
"count": {
"$sum": 1
},
"tasks": {
"$push": "$text"
}
}
},
{
"$sort": {
"count": 1
}
}
]
[
{
"$groupBy": {
"_id": "$status",
"count": {
"$sum": 1
},
"tasks": {
"$push": "$text"
}
}
},
{
"$sort": {
"count": 1
}
}
]
[
{
"$groupBy": {
"_id": "$status",
"count": {
"$sum": 1
},
"tasks": {
"$push": "$text"
}
}
},
{
"$sort": {
"count": 1
}
}
]
[
{
"$groupBy": {
"_id": "$status",
"count": {
"$sum": 1
},
"tasks": {
"$push": "$text"
}
}
},
{
"$sort": {
"count": 1
}
}
]
{
"error": "no authentication methods were specified",
"error_code": "InvalidParameter",
"link": "string"
}
{
"error": "must specify some form of authentication (either email+password, api-key, or jwt) in the request header or body",
"error_code": "MissingParameter",
"link": "string"
}
{
"error": "invalid session: error finding user for endpoint",
"error_code": "InvalidSession",
"link": "string"
}