SYNOPSIS

mongoc_cursor_t *
mongoc_collection_aggregate (mongoc_collection_t       *collection,
                             mongoc_query_flags_t       flags,
                             const bson_t              *pipeline,
                             const mongoc_read_prefs_t *read_prefs)

DESCRIPTION

The mongoc_collection_aggregate() function shall execute an aggregation query on the underlying collection. The bson pipeline is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

In the case of older server versions, < v2.5, the returned cursor is a synthetic iterator over the result set. This provides a limitation insofar as returned documents can be no larger than 16MB. When connecting to newer servers this limitation doesn’t exist. The specific test is for wire_version > 0.

flags are the same as in mongoc_collection_find(3).

RETURN VALUE

The mongoc_collection_aggregate() function returns a new mongoc_cursor(7) if successful. It returns NULL in the event of failure.

ERRORS

errors are detected through active use of the mongoc_cursor(7).

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.