Fix behavior for $type filter on numeric types by guludo · Pull Request #755 · mongomock/mongomock
- Use correct type for "decimal" - Ensure that we do not confuse a Python `bool` for an `int` (since `isinstance(True, int)` evaluates as True). - Check on the bit-length of `int` values to check whether they should be considered "int" or "long" from Mongo's perspective. This patch adds the missing test for $type in `test__mongomock.py`. Note that the "array" type was purposefully ignored from `supported_types`, as there is an issue that will be solved in a future patch: `_type_op([1, 2, 3], t)` should return True for both `t = 'array'` and `t = 'int'`.