def exists(self, bool=True):
        """Determines whether this expression, which must resolve to a field,
        exists and is not None.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            dataset = foz.load_zoo_dataset(
                "quickstart", dataset_name=fo.get_default_dataset_name()
            )

            # Add a new field to one sample
            sample = dataset.first()
            sample["new_field"] = ["hello", "there"]
            sample.save()

            # Get samples that have a value for `new_field`
            view = dataset.match(F("new_field").exists())

            print(len(view))

        Args:
            bool (True): whether to determine whether this expression exists
                (True) or is None or non-existent (False)

        Returns:
            a :class:`ViewExpression`
        """
        # https://stackoverflow.com/a/25515046
        expr = ViewExpression({"$gt": [self, None]})

        if not bool:
            expr = ~expr

        return expr
Determines whether this expression, which must resolve to a field,
        exists and is not None.

        Examples::

            import fiftyone as fo
            import fiftyone.zoo as foz
            from fiftyone import ViewField as F

            dataset = foz.load_zoo_dataset(
                "quickstart", dataset_name=fo.get_default_dataset_name()
            )

            # Add a new field to one sample
            sample = dataset.first()
            sample["new_field"] = ["hello", "there"]
            sample.save()

            # Get samples that have a value for `new_field`
            view = dataset.match(F("new_field").exists())

            print(len(view))

        Args:
            bool (True): whether to determine whether this expression exists
                (True) or is None or non-existent (False)

        Returns:
            a :class:`ViewExpression`
        
fiftyone/core/expressions.py