Skip to content

Aggregate in Collection​

POST
/mongodb/collections/{collectionName}/aggregate

Aggregate in a given Collection. The value of a stage is any JSON value. Operators that run JavaScript on the database server or write to collections ($function, $accumulator, $where, $out, $merge, $currentOp, $listSessions, $collStats, $indexStats by default, configured with AGGREGATION_STAGES_DENIED) are refused with 403.

Authorizations​

httpAuth
Type
HTTP (bearer)
or
httpAuth1
Type
HTTP (basic)
or
apiKeyAuth
Type
API Key (header: X-AUTH-APIKEY)

Parameters​

Path Parameters

collectionName*

The name of your MongoDb Collection

Type
string
Required

Query Parameters

withDeleted

Soft-deleted documents too (collections declared with softDelete, 2.3.0); needs the administrate grant of the collection, 403 otherwise.

Type
boolean
Default
false
rowsPerPage

Count elements per page

Type
integer
Example100
Format
"int64"
page

Requested page of the ResultSets

Type
integer
Example1
Format
"int64"
count

How the result is counted: exact (default) or none (no count headers, no count query)

Type
string
Valid values
"exact""none"
Example"exact"
Default
"exact"
filter

Filter Query like on the list of documents, applied as the first stage of the pipeline. Not possible for a pipeline that starts with $geoNear, $search or $vectorSearch.

Type
string
extendedJson

relaxed (default since 2.0.0) or canonical: the documents as MongoDB Extended JSON with the types of their values ({"$oid": ...}, {"$date": ...}, {"$numberDecimal": ...}; canonical also {"$numberInt": ...}, {"$numberLong": ...} and {"$numberDouble": ...}); a text that looks like a date is {"$string": ...}. plain: the format of 1.x (ids and dates as strings, every number as JSON number, no types).

Type
string
Valid values
"relaxed""canonical""plain"
Default
"relaxed"
filterCaseInsensitive

true: wildcards and prefixes of the Lucene filter ignore the case (the behaviour before 2.0.0). By default they are case-sensitive, so an index on the field serves a prefix like name:abc*

Type
boolean
Examplefalse
Default
false

Request Body​

application/json
JSON
{
  
"pipeline": [
  
  
{
  
  
  
"stage": "string",
  
  
  
"value": null
  
  
}
  
],
  
"allowDiskUse": true,
  
"filter": "string"
}

Responses​

application/json
JSON
[
  
{
  
  
"additionalProperties": null
  
}
]

Playground​

Authorization
Variables
Key
Value
Body

Samples​

Powered by VitePress OpenAPI

Released under the MIT License.