-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
While queries will always return model instances, aggregation pipelines can't do so and will always return BSON::Document instance as per the documentation.
If possible, the documentation should show how users can marshal these objects into models of their choosing so that results from an aggregation pipeline can be combined with business logic defined in models. As an example, Doctrine MongoDB ODM for PHP supports returning custom objects from aggregation pipelines: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/aggregation-builder.html#hydration
- is related to
-
MONGOID-5347 Return model instances from aggregation
- Backlog