The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
data:
    - {_id: 1, x: 11}
    - {_id: 2, x: 22}
    - {_id: 3, x: 33}

tests:
    -
        description: "FindOneAndDelete when many documents match"
        operation:
            name: findOneAndDelete
            arguments:
                filter: 
                    _id: {$gt: 1}
                projection: {x: 1, _id: 0}
                sort: {x: 1}

        outcome:
            result: {x: 22}
            collection:
                data:
                    - {_id: 1, x: 11}
                    - {_id: 3, x: 33}
    -
        description: "FindOneAndDelete when one document matches"
        operation:
            name: findOneAndDelete
            arguments:
                filter: {_id: 2}
                projection: {x: 1, _id: 0}
                sort: {x: 1}

        outcome:
            result: {x: 22}
            collection:
                data:
                    - {_id: 1, x: 11}
                    - {_id: 3, x: 33}
    -
        description: "FindOneAndDelete when no documents match"
        operation:
            name: findOneAndDelete
            arguments:
                filter: {_id: 4}
                projection: {x: 1, _id: 0}
                sort: {x: 1}

        outcome:
            result: null
            collection:
                data:
                    - {_id: 1, x: 11}
                    - {_id: 2, x: 22}
                    - {_id: 3, x: 33}