Skip to content

Support pipeline-style updates in query builder #2070

Open
@alcaeus

Description

@alcaeus

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

With MongoDB 4.2 and version 1.5 of the MongoDB library, it is possible to pass an aggregation pipeline to update operations (findAndModify, update, updates in bulk writes). This should be leveraged in the query builder by integrating a subset of aggregation features.

Possible syntax:

$queryBuilder
    ->field('field')
    ->equals('value')
    ->updateOne()
    ->pipeline()
        ->addFields() // or its alias $set
        ->project() // or its alias $unset
        ->replaceRoot() // or its alias $replaceWith
    ->end()

Other pipeline stages should not be available as they would create a query error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions