Repository: voxel51/fiftyone
Issue: [BUG] Error in filtered field schema

There is a schema-related bug that comes up when working with a view that had a field filtered.
```python
import fiftyone.zoo as foz
from fiftyone import ViewField as F

dataset = foz.load_zoo_dataset("quickstart")
view = dataset.filter_labels("ground_truth", F("label") == "person")
view.select_fields("filepath")
```

```
~/work/fiftyone/fiftyone/fiftyone/core/collections.py in __repr__(self)
     75
     76     def __repr__(self):
---> 77         return self.summary()
     78
     79     def __bool__(self):

~/work/fiftyone/fiftyone/fiftyone/core/view.py in summary(self)
    185         """
    186         aggs = self.aggregate(
--> 187             [foa.Count(), foa.Distinct("tags")], _attach_frames=False
    188         )
    189         elements = [

~/work/fiftyone/fiftyone/fiftyone/core/collections.py in aggregate(self, aggregations, _attach_frames)
   4253
   4254         pipeline = self._pipeline(
-> 4255             pipeline=facets, attach_frames=_attach_frames
   4256         )
   4257

~/work/fiftyone/fiftyone/fiftyone/core/view.py in _pipeline(self, pipeline, attach_frames, detach_frames, frames_only)
    650         _pipeline = []
    651         for s in self._stages:
--> 652             _pipeline.extend(s.to_mongo(self))
    653
    654         if pipeline is not None:

~/work/fiftyone/fiftyone/fiftyone/core/stages.py in to_mongo(self, sample_collection)
   1329
   1330     def to_mongo(self, sample_collection):
-> 1331         self._get_labels_field(sample_collection)
   1332
   1333         labels_field, is_frame_field = sample_collection._handle_frame_field(

~/work/fiftyone/fiftyone/fiftyone/core/stages.py in _get_labels_field(self, sample_collection)
   1371     def _get_labels_field(self, sample_collection):
   1372         field_name, is_list_field, is_frame_field = _get_labels_field(
-> 1373             sample_collection, self._field
   1374         )
   1375         self._is_frame_field = is_frame_field

~/work/fiftyone/fiftyone/fiftyone/core/stages.py in _get_labels_field(sample_collection, field_path)
   3343
   3344 def _get_labels_field(sample_collection, field_path):
-> 3345     field, is_frame_field = _get_field(sample_collection, field_path)
   3346
   3347     if isinstance(field, fof.EmbeddedDocumentField):

~/work/fiftyone/fiftyone/fiftyone/core/stages.py in _get_field(sample_collection, field_path)
   3390     if field_name not in schema:
   3391         ftype = "Frame field" if is_frame_field else "Field"
-> 3392         raise ValueError("%s '%s' does not exist" % (ftype, field_path))
   3393
   3394     field = schema[field_name]

ValueError: Field 'ground_truth' does not exist

```

```python
view.select_fields("ground_truth")
```
This works though for some reason.

Changed files:
fiftyone/core/view.py

diff --git a/fiftyone/core/view.py b/fiftyone/core/view.py
index 99f5ec078..375ccf88c 100644
--- a/fiftyone/core/view.py
+++ b/fiftyone/core/view.py
@@ -49,9 +49,12 @@ class DatasetView(foc.SampleCollection):
         dataset: a :class:`fiftyone.core.dataset.Dataset`
     """
 
-    def __init__(self, dataset):
+    def __init__(self, dataset, _stages=None):
+        if _stages is None:
+            _stages = []
+
         self.__dataset__ = dataset
-        self._stages = []
+        self._stages = _stages
 
     def __len__(self):
         return self.count()
@@ -84,9 +87,8 @@ class DatasetView(foc.SampleCollection):
             )
 
     def __copy__(self):
-        view = self.__class__(self._dataset)
-        view._stages = deepcopy(self._stages)
-        return view
+        _stages = deepcopy(self._stages)
+        return self.__class__(self._dataset, _stages=_stages)
 
     @property
     def _dataset(self):
@@ -214,7 +216,10 @@ class DatasetView(foc.SampleCollection):
             return "    ---"
 
         return "    " + "\\n    ".join(
-            ["%d. %s" % (idx, str(d)) for idx, d in enumerate(self._stages, 1)]
+            [
+                "%d. %s" % (idx, str(stage))
+                for idx, stage in enumerate(self._stages, 1)
+            ]
         )
 
     def view(self):
@@ -634,8 +639,8 @@ class DatasetView(foc.SampleCollection):
         return d
 
     def _needs_frames(self):
-        for s in self._stages:
-            if s._needs_frames(self):
+        for stage in self._stages:
+            if stage._needs_frames(self):
                 return True
 
         return False
@@ -647,9 +652,11 @@ class DatasetView(foc.SampleCollection):
         detach_frames=False,
         frames_only=False,
     ):
+        _view = self._dataset.view()
         _pipeline = []
-        for s in self._stages:
-            _pipeline.extend(s.to_mongo(self))
+        for stage in self._stages:
+            _view = _view.add_stage(stage)
+            _pipeline.extend(stage.to_mongo(_view))
 
         if pipeline is not None:
             _pipeline.extend(pipeline)
@@ -682,7 +689,7 @@ class DatasetView(foc.SampleCollection):
         return self._dataset._doc
 
     def _serialize(self):
-        return [s._serialize() for s in self._stages]
+        return [stage._serialize() for stage in self._stages]
 
     @staticmethod
     def _build(dataset, stage_dicts):