Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5500

Implement marshalling aggregation results into models

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown 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

            Assignee:
            Unassigned Unassigned
            Reporter:
            andreas.braun@mongodb.com Andreas Braun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: