forked from matthewkalan/watch-flights
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-data.js
55 lines (54 loc) · 1.28 KB
/
create-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//started with airlines on-time performance data set in the airlines.flights collection
db.getSiblingDB("airlines").flights.aggregate([
{$match: {"Origin": 'TUS', "Dest": 'SLC', "DepTime": {$gte: 1200,$lt: 1250}}},
{
$project: {
"Year" : 1,
"Quarter" : 1,
"Month" : 1,
"DayofMonth" : 1,
"DayOfWeek" : 1,
"FlightDate" : 1,
"UniqueCarrier" : 1,
"AirlineID" : 1,
"Carrier" : 1,
"TailNum" : 1,
"FlightNum" : 1,
"OriginAirportID" : 1,
"OriginAirportSeqID" : 1,
"OriginCityMarketID" : 1,
"Origin" : 1,
"OriginCityName" : 1,
"OriginState" : 1,
"OriginStateFips" : 1,
"OriginStateName" : 1,
"OriginWac" : 1,
"DestAirportID" : 1,
"DestAirportSeqID" : 1,
"DestCityMarketID" : 1,
"Dest" : 1,
"DestCityName" : 1,
"DestState" : 1,
"DestStateFips" : 1,
"DestStateName" : 1,
"DestWac" : 1,
"CRSDepTime" : 1,
"DepTime" : 1,
"ArrTime" : 1,
"ArrDelay" : 1,
"ArrDel15" : 1,
"ArrivalDelayGroups" : 1,
"ArrTimeBlk" : 1,
"Cancelled" :10,
"CancellationCode" : 1,
"Diverted" : 1,
"CRSElapsedTime" : 1,
"AirTime" : 1,
"Flights" : 1,
"Distance" : 1,
"DistanceGroup" : 1
}
},
{$addFields: {"seatsAvail": 2}},
{$out: "flightInventory" }
])