Implemented '$concatArrays' aggregation pipeline operator by lmoretto · Pull Request #672 · mongomock/mongomock

@lmoretto

This PR implements the $concatArrays aggregation pipeline operator.

@lmoretto

@codecov

@lmoretto

Hi @pcorpet,
I just saw that the codecov check fails.

However I think this is caused by the fact that, having now implemented $concatArrays, the following piece of code is no longer hit by existing test cases:

raise NotImplementedError(
"Although '%s' is a valid array operator for the "
'aggregation pipeline, it is currently not implemented '
'in Mongomock.' % operator)

Do you think I should change something?

pcorpet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. yes please make sure to switch the testing code to still cover the NotImplemented branch (with another array operator).

Also I have few other test cases that I'd like you to add.

@lmoretto

@lmoretto

Hi @pcorpet, I applied the requested changes ;)

pcorpet

}
}
]
with self.assertRaises(OperationFailure):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the self.cmp.compare_exceptions.aggregate(pipeline_parameter_not_array) function, same below. This ensures we use the same type of error in Pymongo and in mongomock without the need of the extra code.

@lmoretto

@pcorpet

Thanks a lot for the feature, I'm merging.

@lmoretto

Great, thank you for merging this and for the great work you are doing with this project.

In the next few days i plan to also implement $map and $reduce aggregation operators.
Will a single PR for both operators be ok, or do you prefer two separate ones?

@pcorpet