-
Notifications
You must be signed in to change notification settings - Fork 1
/
CS3550TylerSmithA14.js
192 lines (168 loc) · 4.86 KB
/
CS3550TylerSmithA14.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
use PurpleBox
db.createCollection("Movie")
db.createCollection("MovieItem")
db.createCollection("Users")
db.createCollection("Rentals")
db.Movie.save(
{
"_id" : 1000,
"MovieID" : "SWFA",
"Title" : "Star Wars The Force Awakens",
"Keywords" : "space",
"Genre" : "Action",
"Actors" : [ { "Actor Name": "Harrison Ford" }, { "Actor Name": "Mark Hamill" }, { "Actor Name": "Carrie Fisher" } ],
"Director" : "J.J. Abrams"
}
)
db.Movie.save(
{
"_id" : 1001,
"MovieID" : "ST09",
"Title" : "Star Trek",
"Keywords" : "future",
"Genre" : "Sci-Fi",
"Actors" : [ { "Actor Name": "Chris Pine" }, { "Actor Name": "Zachary Quinto" }, { "Actor Name": "Zoe Saldana" } ],
"Director" : "J.J. Abrams"
}
)
db.Movie.save(
{
"_id" : 1002,
"MovieID" : "HAGI",
"Title" : "Happy Gilmore",
"Keywords" : "golf",
"Genre" : "Comedy",
"Actors" : [ { "Actor Name": "Adam Sandler" }, { "Actor Name": "Christopher McDonald" }, { "Actor Name": "Julie Bowen" } ],
"Director" : "Dennis Dugan"
}
)
db.MovieItem.save(
{
"_id" : 1000,
"MovieID" : "HAGI",
"Title" : "Happy Gilmore",
"MovieItemID" : "Happ001",
"Format" : "BLU",
"CopyNum" : 2,
"RentalDate" : ISODate("2017-02-10T08:21:72.289Z"),
"ReturnDate" : ISODate("2017-02-13T10:40:42.379Z"),
"DueDate" : ISODate("2017-02-13T11:40:22.389Z")
}
)
db.MovieItem.save(
{
"_id" : 1001,
"MovieID" : "SWFA",
"Title" : "Star Wars The Force Awakens",
"MovieItemID" : "SWFA001",
"Format" : "BLU",
"CopyNum" : 3,
"RentalDate" : ISODate("2017-03-09T08:21:72.289Z"),
"ReturnDate" : ISODate("2017-03-13T11:40:42.379Z"),
"DueDate" : ISODate("2017-03-12T11:40:22.389Z")
}
)
db.MovieItem.save(
{
"_id" : 1002,
"MovieID" : "ST09",
"Title" : "Star Trek",
"MovieItemID" : "STTR001",
"Format" : "DVD",
"CopyNum" : 17,
"RentalDate" : ISODate("2017-03-09T09:21:72.289Z"),
"ReturnDate" : ISODate("2017-03-12T12:40:42.379Z"),
"DueDate" : ISODate("2017-03-12T11:40:22.589Z")
}
)
db.Users.save(
{
"_id" : 1000,
"UserID" : "SP9001",
"First Name" : "Jon",
"Last Name" : "Bon Jovi",
"UserType" : "Admin",
"Password" : "LivinonaPrayer",
"Security Questions" :
[ { "Question 1" : "What Bruce Willis Movie?" }, { "Question 2" : "What is your real last name?" } ],
"Security Question Answers" :
[ { "Answer 1" : "Armageddon " }, { "Answer 2" : "Bongiovi" } ],
"Phone Numbers" :
[{"Phone Number" : "665-254-6658"},
{"Phone Number" : "669-574-3691"}],
"CustType" : "R",
"CustStatus" : "Good",
"Overdue Fees" : 0,
"Quota" : 2,
}
)
db.Users.save(
{
"_id" : 1001,
"UserID" : "SANT662",
"First Name" : "Kent",
"Last Name" : "Brockman",
"UserType" : "Cust",
"Password" : "Simpsons2",
"Security Questions" :
[ { "Question 1" : "What is your Occupation?" }, { "Question 2" : "What is your wife's name?" } ],
"Security Question Answers" :
[ { "Answer 1" : "News anchor" }, { "Answer 2" : "Stephanie" } ],
"Phone Numbers" :
[{"Phone Number" : "998-874-6621"},
{"Phone Number" : "998-227-3699"}],
"CustType" : "R",
"CustStatus" : "Good",
"Overdue Fees" : 0,
"Quota" : 2,
}
)
db.Rentals.save(
{
"_id" : 1000,
"UserID" : "SP9001",
"MovieID" : "ST09",
"Title" : "Star Trek",
"MovieItemID" : "STTR001",
"Format" : "DVD",
"CopyNum" : 17,
"RentalDate" : ISODate("2017-03-09T09:21:72.289Z"),
"ReturnDate" : null,
"DueDate" : ISODate("2017-03-12T11:40:22.589Z")
}
)
db.Rentals.save(
{
"_id" : 1001,
"MovieID" : "SWFA",
"UserID" : "SP9001",
"Title" : "Star Wars The Force Awakens",
"MovieItemID" : "SWFA001",
"Format" : "BLU",
"CopyNum" : 3,
"RentalDate" : ISODate("2017-03-09T08:21:72.289Z"),
"ReturnDate" : null,
"DueDate" : ISODate("2017-03-12T11:40:22.389Z")
}
)
db.getCollection('Rentals').find({})
db.getCollection('MovieItem').find({_id: {$gt:100}}, {_id:0, MovieID:1, Title:1, CopyNum:1,Format:1})
db.getCollection('Rentals').find({_id: {$gt:100}},
{_id:0, MovieItemID:1, UserID:1, RentalDate:1, ReturnDate:1 })
db.Rentals.save(
{
"_id" : 1001,
"MovieID" : "SWFA",
"UserID" : "SP9001",
"Title" : "Star Wars The Force Awakens",
"MovieItemID" : "SWFA001",
"Format" : "BLU",
"CopyNum" : 3,
"RentalDate" : ISODate("2017-03-09T08:21:72.289Z"),
"ReturnDate" : ISODate("2017-03-13T11:40:42.379Z"),
"DueDate" : ISODate("2017-03-12T11:40:22.389Z")
}
)
db.getCollection('Rentals').find({_id: {$gt:100}},
{_id:0, MovieItemID:1, UserID:1, RentalDate:1, ReturnDate:1 })
db.getCollection('MovieItem').remove({ 'MovieID' : 'HAGI' });