1 00:00:02,310 --> 00:00:06,560 I'm back to our pipeline we built earlier, you'll find it attached to this video. 2 00:00:06,660 --> 00:00:15,620 This pipeline here will return us persons in a restructured form where we also have the location. 3 00:00:15,940 --> 00:00:20,580 Now if you want to use that location, we can do that inside of our pipeline here, 4 00:00:20,590 --> 00:00:22,640 we do actually have a pipeline stage 5 00:00:22,660 --> 00:00:29,480 for working with geo data but that has to always come first in order to take advantage of indexes. 6 00:00:29,560 --> 00:00:31,110 Now what can we do? 7 00:00:31,600 --> 00:00:37,620 Well the good thing is you can also take the result of a pipeline and write it into a new collection, 8 00:00:37,660 --> 00:00:44,320 of course not just if you have geo data in there, you can always do that. For that you do specify another 9 00:00:44,320 --> 00:00:52,570 pipeline stage, the $out stage for output and this will take the result of your operation 10 00:00:52,780 --> 00:00:59,840 and write it into a collection, either a new one which is created on the fly or an existing one. I'll name 11 00:00:59,840 --> 00:01:04,470 this transformed persons, 12 00:01:04,630 --> 00:01:13,470 so I only added this stage. If I now copy that and I run it without pretty at the end by the way 13 00:01:13,670 --> 00:01:15,560 but it should have still worked, 14 00:01:15,620 --> 00:01:26,470 you see I have my transformed persons there. And if I look into transformed persons, you see the structure 15 00:01:26,470 --> 00:01:30,130 in there is exactly the structure we created in the last pipeline. 16 00:01:30,430 --> 00:01:36,610 So the out operator is great if you have a pipeline where you want to funnel your results right into 17 00:01:36,610 --> 00:01:37,730 a new collection, 18 00:01:38,110 --> 00:01:40,950 often you want to use it and just fetch it 19 00:01:40,960 --> 00:01:44,620 but if you need to store it, you can do that with the out stage.