diff --git a/graphene_mongo/fields.py b/graphene_mongo/fields.py index 610325e8..08542ff1 100644 --- a/graphene_mongo/fields.py +++ b/graphene_mongo/fields.py @@ -121,11 +121,13 @@ def is_filterable(k): ), ): return False - if getattr(converted, "type", None) and getattr(converted.type, "_of_type", None) and issubclass( - (get_type(converted.type.of_type)), graphene.Union): + + # Fix for https://github.com/graphql-python/graphene-mongo/issues/162 + if getattr(converted, "type", None) and getattr(converted.type, "_of_type", None) and not issubclass( + (get_type(converted.type.of_type)), graphene.Scalar): return False - if isinstance(converted, (graphene.List)) and issubclass( - getattr(converted, "_of_type", None), graphene.Union + if isinstance(converted, (graphene.List)) and not issubclass( + getattr(converted, "_of_type", None), graphene.Scalar ): return False return True