diff --git a/mongo.pdf b/mongo.pdf index e0001f3..043c963 100644 Binary files a/mongo.pdf and b/mongo.pdf differ diff --git a/mongo.tex b/mongo.tex index c4c5c01..5029b9f 100644 --- a/mongo.tex +++ b/mongo.tex @@ -68,16 +68,14 @@ \section{Schemat bazy - kolekcje} - Opracowana baza danych składa się z 6 kolekcji, łącznie zawierających 30 dokumentów. + Opracowana baza danych składa się z 6 kolekcji, łącznie zawierających 70 dokumentów. Poniżej przedstawiono szczegółowy opis każdej kolekcji wraz z przykładowymi dokumentami. - \caption{Struktura bazy danych systemu hotelowego w MongoDB} - \subsection{Kolekcja: guests} \textbf{Opis:} Przechowuje dane gości hotelowych wraz z informacjami kontaktowymi i dodatkowymi atrybutami. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 15 \textbf{Struktura dokumentu:} @@ -125,7 +123,7 @@ \textbf{Opis:} Zawiera informacje o pokojach hotelowych, ich typach, wyposażeniu i statusie dostępności. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 12 \textbf{Struktura dokumentu:} @@ -164,7 +162,7 @@ \textbf{Opis:} Przechowuje informacje o rezerwacjach gości, zawiera referencje do kolekcji guests i rooms. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 10 \textbf{Struktura dokumentu:} @@ -206,7 +204,7 @@ \textbf{Opis:} Zawiera dane pracowników hotelu wraz z informacjami o stanowisku, wynagrodzeniu i harmonogramie pracy. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 8 \textbf{Struktura dokumentu:} @@ -260,7 +258,7 @@ \textbf{Opis:} Zawiera katalog usług dodatkowych oferowanych przez hotel. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 10 \textbf{Struktura dokumentu:} @@ -296,7 +294,7 @@ \textbf{Opis:} Przechowuje zamówienia na usługi dodatkowe składane przez gości hotelowych. - \textbf{Liczba dokumentów:} 5 + \textbf{Liczba dokumentów:} 15 \textbf{Struktura dokumentu:} @@ -562,6 +560,9 @@ db.services.createIndex({ category: 1, price: 1 }) // Indeks dla szybszego łączenia zamówień usług z usługami db.serviceOrders.createIndex({ serviceId: 1 }) + +// Indeks dla szybszego łączenia pracowników z działami i stanowiskami +db.employees.createIndex({ department: 1, position: 1 }); \end{minted} Indeksy przyspieszają operacje wyszukiwania i łączenia danych, szczególnie w przypadku złożonych zapytań agregujących. diff --git a/skrypt.js b/skrypt.js index 6faef14..0669dbf 100644 --- a/skrypt.js +++ b/skrypt.js @@ -12,11 +12,11 @@ db.guests.insertMany([ city: "Warszawa", postalCode: "01-234", country: "Polska" - }, + }, dateOfBirth: new Date("1985-05-15"), loyaltyPoints: 120, registrationDate: new Date("2020-03-10") - }, + }, { firstName: "Anna", lastName: "Nowak", @@ -27,11 +27,11 @@ db.guests.insertMany([ city: "Kraków", postalCode: "30-001", country: "Polska" - }, + }, dateOfBirth: new Date("1990-11-22"), loyaltyPoints: 45, registrationDate: new Date("2021-01-15") - }, + }, { firstName: "Thomas", lastName: "Schmidt", @@ -42,11 +42,11 @@ db.guests.insertMany([ city: "Berlin", postalCode: "10115", country: "Niemcy" - }, + }, dateOfBirth: new Date("1978-07-30"), loyaltyPoints: 230, registrationDate: new Date("2019-06-20") - }, + }, { firstName: "Maria", lastName: "Garcia", @@ -57,11 +57,11 @@ db.guests.insertMany([ city: "Barcelona", postalCode: "08001", country: "Hiszpania" - }, + }, dateOfBirth: new Date("1992-03-12"), loyaltyPoints: 85, registrationDate: new Date("2021-09-05") - }, + }, { firstName: "John", lastName: "Smith", @@ -72,12 +72,162 @@ db.guests.insertMany([ city: "London", postalCode: "SW1A 1AA", country: "Wielka Brytania" - }, + }, dateOfBirth: new Date("1980-12-05"), loyaltyPoints: 175, registrationDate: new Date("2020-07-18") - } - ]); + }, + { + firstName: "Sophie", + lastName: "Dubois", + email: "sophie.dubois@email.com", + phoneNumber: "+33123456789", + address: { + street: "Rue de la Paix 10", + city: "Paris", + postalCode: "75001", + country: "Francja" + }, + dateOfBirth: new Date("1987-09-14"), + loyaltyPoints: 310, + registrationDate: new Date("2019-11-12") + }, + { + firstName: "Marco", + lastName: "Rossi", + email: "marco.rossi@email.com", + phoneNumber: "+39123456789", + address: { + street: "Via Roma 25", + city: "Milano", + postalCode: "20121", + country: "Włochy" + }, + dateOfBirth: new Date("1983-02-28"), + loyaltyPoints: 95, + registrationDate: new Date("2021-05-20") + }, + { + firstName: "Katarzyna", + lastName: "Lewandowska", + email: "katarzyna.lewandowska@email.com", + phoneNumber: "+48345678912", + address: { + street: "Spacerowa 18", + city: "Gdańsk", + postalCode: "80-001", + country: "Polska" + }, + dateOfBirth: new Date("1995-06-11"), + loyaltyPoints: 60, + registrationDate: new Date("2022-02-10") + }, + { + firstName: "Erik", + lastName: "Andersson", + email: "erik.andersson@email.com", + phoneNumber: "+46123456789", + address: { + street: "Storgatan 14", + city: "Stockholm", + postalCode: "11122", + country: "Szwecja" + }, + dateOfBirth: new Date("1989-04-18"), + loyaltyPoints: 155, + registrationDate: new Date("2020-08-30") + }, + { + firstName: "Isabella", + lastName: "Rodriguez", + email: "isabella.rodriguez@email.com", + phoneNumber: "+52123456789", + address: { + street: "Avenida Reforma 100", + city: "Mexico City", + postalCode: "06600", + country: "Meksyk" + }, + dateOfBirth: new Date("1991-12-03"), + loyaltyPoints: 205, + registrationDate: new Date("2020-12-15") + }, + { + firstName: "Michał", + lastName: "Wójcik", + email: "michal.wojcik@email.com", + phoneNumber: "+48456789123", + address: { + street: "Nadwiślańska 22", + city: "Wrocław", + postalCode: "50-266", + country: "Polska" + }, + dateOfBirth: new Date("1976-08-25"), + loyaltyPoints: 340, + registrationDate: new Date("2018-03-05") + }, + { + firstName: "Emma", + lastName: "Johnson", + email: "emma.johnson@email.com", + phoneNumber: "+1234567890", + address: { + street: "Fifth Avenue 123", + city: "New York", + postalCode: "10001", + country: "USA" + }, + dateOfBirth: new Date("1988-01-17"), + loyaltyPoints: 280, + registrationDate: new Date("2019-07-22") + }, + { + firstName: "Aleksandr", + lastName: "Petrov", + email: "aleksandr.petrov@email.com", + phoneNumber: "+7123456789", + address: { + street: "Nevsky Prospekt 50", + city: "Sankt Petersburg", + postalCode: "190000", + country: "Rosja" + }, + dateOfBirth: new Date("1982-10-08"), + loyaltyPoints: 190, + registrationDate: new Date("2020-04-18") + }, + { + firstName: "Yuki", + lastName: "Tanaka", + email: "yuki.tanaka@email.com", + phoneNumber: "+81123456789", + address: { + street: "Shibuya 1-1-1", + city: "Tokyo", + postalCode: "150-0002", + country: "Japonia" + }, + dateOfBirth: new Date("1993-07-20"), + loyaltyPoints: 75, + registrationDate: new Date("2021-11-08") + }, + { + firstName: "Agnieszka", + lastName: "Mazur", + email: "agnieszka.mazur@email.com", + phoneNumber: "+48567891234", + address: { + street: "Parkowa 5", + city: "Poznań", + postalCode: "61-001", + country: "Polska" + }, + dateOfBirth: new Date("1994-03-22"), + loyaltyPoints: 110, + registrationDate: new Date("2021-08-14") + } +]); // 2. Kolekcja: Pokoje hotelowe db.rooms.insertMany([ @@ -90,7 +240,7 @@ db.rooms.insertMany([ amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja"], status: "Dostępny", lastRenovation: new Date("2021-03-15") - }, + }, { roomNumber: "102", floor: 1, @@ -100,7 +250,27 @@ db.rooms.insertMany([ amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja"], status: "Dostępny", lastRenovation: new Date("2021-03-20") - }, + }, + { + roomNumber: "103", + floor: 1, + type: "Standard", + capacity: 2, + pricePerNight: 250.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja"], + status: "Zajęty", + lastRenovation: new Date("2021-04-01") + }, + { + roomNumber: "104", + floor: 1, + type: "Standard Plus", + capacity: 3, + pricePerNight: 320.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf"], + status: "Dostępny", + lastRenovation: new Date("2021-04-15") + }, { roomNumber: "201", floor: 2, @@ -110,7 +280,27 @@ db.rooms.insertMany([ amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy"], status: "Zajęty", lastRenovation: new Date("2022-01-10") - }, + }, + { + roomNumber: "202", + floor: 2, + type: "Deluxe", + capacity: 3, + pricePerNight: 400.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy"], + status: "Dostępny", + lastRenovation: new Date("2022-01-15") + }, + { + roomNumber: "203", + floor: 2, + type: "Deluxe", + capacity: 3, + pricePerNight: 400.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy"], + status: "Serwis", + lastRenovation: new Date("2022-01-20") + }, { roomNumber: "301", floor: 3, @@ -120,7 +310,7 @@ db.rooms.insertMany([ amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy", "Jacuzzi"], status: "Dostępny", lastRenovation: new Date("2022-02-15") - }, + }, { roomNumber: "302", floor: 3, @@ -130,8 +320,38 @@ db.rooms.insertMany([ amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy", "Jacuzzi", "Sauna"], status: "Dostępny", lastRenovation: new Date("2022-02-20") - } - ]); + }, + { + roomNumber: "303", + floor: 3, + type: "Suite", + capacity: 4, + pricePerNight: 600.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy", "Jacuzzi"], + status: "Zajęty", + lastRenovation: new Date("2022-03-01") + }, + { + roomNumber: "401", + floor: 4, + type: "Penthouse", + capacity: 6, + pricePerNight: 1200.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy", "Jacuzzi", "Sauna", "Taras"], + status: "Dostępny", + lastRenovation: new Date("2022-05-10") + }, + { + roomNumber: "402", + floor: 4, + type: "Penthouse", + capacity: 6, + pricePerNight: 1200.00, + amenities: ["TV", "WiFi", "Minibar", "Klimatyzacja", "Sejf", "Ekspres do kawy", "Jacuzzi", "Sauna", "Taras"], + status: "Dostępny", + lastRenovation: new Date("2022-05-15") + } +]); // 3. Kolekcja: Usługi dodatkowe db.services.insertMany([ @@ -143,7 +363,7 @@ db.services.insertMany([ availability: ["Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], location: "Restauracja hotelowa", requiresReservation: false - }, + }, { name: "Masaż relaksacyjny", description: "60-minutowy masaż relaksacyjny", @@ -152,7 +372,7 @@ db.services.insertMany([ availability: ["Poniedziałek", "Środa", "Piątek", "Sobota"], location: "Hotelowe SPA", requiresReservation: true - }, + }, { name: "Transfer z lotniska", description: "Transport z lotniska do hotelu", @@ -161,7 +381,7 @@ db.services.insertMany([ availability: ["Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], location: "Lotnisko", requiresReservation: true - }, + }, { name: "Wynajem roweru", description: "Wypożyczenie roweru na cały dzień", @@ -170,7 +390,7 @@ db.services.insertMany([ availability: ["Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], location: "Recepcja", requiresReservation: false - }, + }, { name: "Kolacja przy świecach", description: "Romantyczna kolacja dla dwojga", @@ -179,8 +399,53 @@ db.services.insertMany([ availability: ["Piątek", "Sobota"], location: "Taras widokowy", requiresReservation: true - } - ]); + }, + { + name: "Sesja w saunie", + description: "90-minutowa sesja w saunie z aromaterapią", + price: 150.00, + category: "SPA", + availability: ["Wtorek", "Czwartek", "Sobota", "Niedziela"], + location: "Hotelowe SPA", + requiresReservation: true + }, + { + name: "Parking", + description: "Miejsce parkingowe na dobę", + price: 40.00, + category: "Transport", + availability: ["Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], + location: "Parking hotelowy", + requiresReservation: false + }, + { + name: "Kurs gotowania", + description: "2-godzinny kurs gotowania regionalnych potraw", + price: 250.00, + category: "Rekreacja", + availability: ["Środa", "Sobota"], + location: "Kuchnia hotelowa", + requiresReservation: true + }, + { + name: "Wycieczka po mieście", + description: "4-godzinna zwiedzanie miasta z przewodnikiem", + price: 180.00, + category: "Rekreacja", + availability: ["Wtorek", "Czwartek", "Sobota"], + location: "Start z recepcji", + requiresReservation: true + }, + { + name: "Pranie i prasowanie", + description: "Usługa prania i prasowania odzieży", + price: 30.00, + category: "Dodatkowe", + availability: ["Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek"], + location: "Pralnia hotelowa", + requiresReservation: false + } +]); // 4. Kolekcja: Pracownicy db.employees.insertMany([ @@ -200,8 +465,8 @@ db.employees.insertMany([ city: "Warszawa", postalCode: "02-123", country: "Polska" - } - }, + } + }, { firstName: "Marta", lastName: "Kowalczyk", @@ -218,8 +483,8 @@ db.employees.insertMany([ city: "Warszawa", postalCode: "03-456", country: "Polska" - } - }, + } + }, { firstName: "Tomasz", lastName: "Nowicki", @@ -236,8 +501,8 @@ db.employees.insertMany([ city: "Pruszków", postalCode: "05-800", country: "Polska" - } - }, + } + }, { firstName: "Katarzyna", lastName: "Zielińska", @@ -254,8 +519,8 @@ db.employees.insertMany([ city: "Warszawa", postalCode: "00-120", country: "Polska" - } - }, + } + }, { firstName: "Marek", lastName: "Jankowski", @@ -272,9 +537,63 @@ db.employees.insertMany([ city: "Piaseczno", postalCode: "05-500", country: "Polska" - } } - ]); + }, + { + firstName: "Joanna", + lastName: "Kamińska", + position: "Recepcjonista", + email: "joanna.kaminska@hotel.com", + phoneNumber: "+48890123456", + dateOfBirth: new Date("1990-02-08"), + hireDate: new Date("2020-11-15"), + salary: 4300.00, + department: "Recepcja", + workSchedule: ["Sobota", "Niedziela", "Poniedziałek", "Wtorek", "Środa"], + address: { + street: "Wiśniowa 15", + city: "Warszawa", + postalCode: "04-567", + country: "Polska" + } + }, + { + firstName: "Robert", + lastName: "Kowalski", + position: "Kucharz", + email: "robert.kowalski@hotel.com", + phoneNumber: "+48901234567", + dateOfBirth: new Date("1985-12-20"), + hireDate: new Date("2019-08-01"), + salary: 5200.00, + department: "Restauracja", + workSchedule: ["Czwartek", "Piątek", "Sobota", "Niedziela"], + address: { + street: "Klonowa 3", + city: "Warszawa", + postalCode: "05-234", + country: "Polska" + } + }, + { + firstName: "Magdalena", + lastName: "Wójcik", + position: "Masażystka", + email: "magdalena.wojcik@hotel.com", + phoneNumber: "+48012345678", + dateOfBirth: new Date("1987-06-18"), + hireDate: new Date("2021-03-01"), + salary: 5800.00, + department: "SPA", + workSchedule: ["Poniedziałek", "Środa", "Piątek", "Sobota"], + address: { + street: "Lipowa 9", + city: "Otwock", + postalCode: "05-400", + country: "Polska" + } + } +]); // 5. Kolekcja: Rezerwacje const jan_id = db.guests.findOne({firstName: "Jan", lastName: "Kowalski"})._id; @@ -282,13 +601,22 @@ const anna_id = db.guests.findOne({firstName: "Anna", lastName: "Nowak"})._id; const thomas_id = db.guests.findOne({firstName: "Thomas", lastName: "Schmidt"})._id; const maria_id = db.guests.findOne({firstName: "Maria", lastName: "Garcia"})._id; const john_id = db.guests.findOne({firstName: "John", lastName: "Smith"})._id; +const sophie_id = db.guests.findOne({firstName: "Sophie", lastName: "Dubois"})._id; +const marco_id = db.guests.findOne({firstName: "Marco", lastName: "Rossi"})._id; +const katarzyna_id = db.guests.findOne({firstName: "Katarzyna", lastName: "Lewandowska"})._id; +const erik_id = db.guests.findOne({firstName: "Erik", lastName: "Andersson"})._id; +const isabella_id = db.guests.findOne({firstName: "Isabella", lastName: "Rodriguez"})._id; const room101_id = db.rooms.findOne({roomNumber: "101"})._id; const room102_id = db.rooms.findOne({roomNumber: "102"})._id; +const room103_id = db.rooms.findOne({roomNumber: "103"})._id; +const room104_id = db.rooms.findOne({roomNumber: "104"})._id; const room201_id = db.rooms.findOne({roomNumber: "201"})._id; +const room202_id = db.rooms.findOne({roomNumber: "202"})._id; const room301_id = db.rooms.findOne({roomNumber: "301"})._id; const room302_id = db.rooms.findOne({roomNumber: "302"})._id; - +const room303_id = db.rooms.findOne({roomNumber: "303"})._id; +const room401_id = db.rooms.findOne({roomNumber: "401"})._id; db.reservations.insertMany([ { @@ -302,7 +630,7 @@ db.reservations.insertMany([ specialRequests: ["Późne zameldowanie", "Dodatkowa poduszka"], bookingDate: new Date("2023-04-15"), status: "Potwierdzona" - }, + }, { guestId: anna_id, roomId: room201_id, @@ -314,7 +642,7 @@ db.reservations.insertMany([ specialRequests: [], bookingDate: new Date("2023-05-01"), status: "Potwierdzona" - }, + }, { guestId: thomas_id, roomId: room301_id, @@ -326,7 +654,7 @@ db.reservations.insertMany([ specialRequests: ["Widok na miasto"], bookingDate: new Date("2023-05-05"), status: "Oczekująca" - }, + }, { guestId: maria_id, roomId: room102_id, @@ -338,7 +666,7 @@ db.reservations.insertMany([ specialRequests: [], bookingDate: new Date("2023-05-20"), status: "Potwierdzona" - }, + }, { guestId: john_id, roomId: room302_id, @@ -350,9 +678,68 @@ db.reservations.insertMany([ specialRequests: ["Łóżeczko dla dziecka", "Późne wymeldowanie"], bookingDate: new Date("2023-05-10"), status: "Potwierdzona" - } - ]); - + }, + { + guestId: sophie_id, + roomId: room303_id, + checkInDate: new Date("2023-08-01"), + checkOutDate: new Date("2023-08-07"), + numberOfGuests: 2, + totalPrice: 3600.00, + paymentStatus: "Opłacone", + specialRequests: ["Champagne powitalny", "Kwiaty w pokoju"], + bookingDate: new Date("2023-07-01"), + status: "Potwierdzona" + }, + { + guestId: marco_id, + roomId: room104_id, + checkInDate: new Date("2023-09-10"), + checkOutDate: new Date("2023-09-15"), + numberOfGuests: 2, + totalPrice: 1600.00, + paymentStatus: "Zaliczka", + specialRequests: ["Pokój dla niepalących"], + bookingDate: new Date("2023-08-15"), + status: "Potwierdzona" + }, + { + guestId: katarzyna_id, + roomId: room202_id, + checkInDate: new Date("2023-10-01"), + checkOutDate: new Date("2023-10-05"), + numberOfGuests: 1, + totalPrice: 1600.00, + paymentStatus: "Oczekuje na płatność", + specialRequests: ["Cichy pokój"], + bookingDate: new Date("2023-09-10"), + status: "Oczekująca" + }, + { + guestId: erik_id, + roomId: room401_id, + checkInDate: new Date("2023-11-15"), + checkOutDate: new Date("2023-11-20"), + numberOfGuests: 4, + totalPrice: 6000.00, + paymentStatus: "Opłacone", + specialRequests: ["Transfer z lotniska", "Kolacja welcome"], + bookingDate: new Date("2023-10-01"), + status: "Potwierdzona" + }, + { + guestId: isabella_id, + roomId: room103_id, + checkInDate: new Date("2023-12-20"), + checkOutDate: new Date("2023-12-27"), + numberOfGuests: 2, + totalPrice: 1750.00, + paymentStatus: "Zaliczka", + specialRequests: ["Dekoracje świąteczne"], + bookingDate: new Date("2023-11-15"), + status: "Potwierdzona" + } +]); // 6. Kolekcja: Zamówienia usług const breakfast_id = db.services.findOne({name: "Śniadanie"})._id; @@ -360,13 +747,22 @@ const massage_id = db.services.findOne({name: "Masaż relaksacyjny"})._id; const transfer_id = db.services.findOne({name: "Transfer z lotniska"})._id; const bike_id = db.services.findOne({name: "Wynajem roweru"})._id; const dinner_id = db.services.findOne({name: "Kolacja przy świecach"})._id; +const sauna_id = db.services.findOne({name: "Sesja w saunie"})._id; +const parking_id = db.services.findOne({name: "Parking"})._id; +const cooking_id = db.services.findOne({name: "Kurs gotowania"})._id; +const tour_id = db.services.findOne({name: "Wycieczka po mieście"})._id; +const laundry_id = db.services.findOne({name: "Pranie i prasowanie"})._id; const jan_res_id = db.reservations.findOne({guestId: jan_id})._id; const anna_res_id = db.reservations.findOne({guestId: anna_id})._id; const thomas_res_id = db.reservations.findOne({guestId: thomas_id})._id; const maria_res_id = db.reservations.findOne({guestId: maria_id})._id; const john_res_id = db.reservations.findOne({guestId: john_id})._id; - +const sophie_res_id = db.reservations.findOne({guestId: sophie_id})._id; +const marco_res_id = db.reservations.findOne({guestId: marco_id})._id; +const katarzyna_res_id = db.reservations.findOne({guestId: katarzyna_id})._id; +const erik_res_id = db.reservations.findOne({guestId: erik_id})._id; +const isabella_res_id = db.reservations.findOne({guestId: isabella_id})._id; db.serviceOrders.insertMany([ { @@ -378,7 +774,7 @@ db.serviceOrders.insertMany([ totalPrice: 100.00, status: "Zrealizowane", comments: "Śniadanie do pokoju" - }, + }, { guestId: thomas_id, reservationId: thomas_res_id, @@ -388,7 +784,7 @@ db.serviceOrders.insertMany([ totalPrice: 200.00, status: "Potwierdzone", comments: "Masaż na godzinę 15:00" - }, + }, { guestId: anna_id, reservationId: anna_res_id, @@ -398,7 +794,7 @@ db.serviceOrders.insertMany([ totalPrice: 120.00, status: "Potwierdzone", comments: "Odbiór z lotniska o 14:30" - }, + }, { guestId: maria_id, reservationId: maria_res_id, @@ -408,7 +804,7 @@ db.serviceOrders.insertMany([ totalPrice: 100.00, status: "Oczekujące", comments: "Dwa rowery na cały dzień" - }, + }, { guestId: john_id, reservationId: john_res_id, @@ -418,24 +814,115 @@ db.serviceOrders.insertMany([ totalPrice: 300.00, status: "Potwierdzone", comments: "Kolacja na 20:00, rocznica ślubu" - } - ]); - - - - - -db.rooms.createIndex({ roomNumber: 1 }, { unique: true }) - -db.guests.createIndex({ lastName: 1, firstName: 1 }) - -db.reservations.createIndex({ checkInDate: 1, checkOutDate: 1 }) - -db.reservations.createIndex({ roomId: 1 }) - -db.reservations.createIndex({ guestId: 1 }) - -db.services.createIndex({ category: 1, price: 1 }) - -db.serviceOrders.createIndex({ serviceId: 1 }) + }, + { + guestId: sophie_id, + reservationId: sophie_res_id, + serviceId: sauna_id, + orderDate: new Date("2023-08-03"), + quantity: 1, + totalPrice: 150.00, + status: "Zrealizowane", + comments: "Aromaterapia lawendowa" + }, + { + guestId: marco_id, + reservationId: marco_res_id, + serviceId: parking_id, + orderDate: new Date("2023-09-10"), + quantity: 5, + totalPrice: 200.00, + status: "Potwierdzone", + comments: "Parking na cały pobyt" + }, + { + guestId: erik_id, + reservationId: erik_res_id, + serviceId: cooking_id, + orderDate: new Date("2023-11-17"), + quantity: 1, + totalPrice: 250.00, + status: "Potwierdzone", + comments: "Kurs regionalnej kuchni polskiej" + }, + { + guestId: isabella_id, + reservationId: isabella_res_id, + serviceId: tour_id, + orderDate: new Date("2023-12-22"), + quantity: 1, + totalPrice: 180.00, + status: "Oczekujące", + comments: "Wycieczka świąteczna po Starówce" + }, + { + guestId: jan_id, + reservationId: jan_res_id, + serviceId: laundry_id, + orderDate: new Date("2023-05-12"), + quantity: 3, + totalPrice: 90.00, + status: "Zrealizowane", + comments: "Ekspresowe pranie" + }, + { + guestId: anna_id, + reservationId: anna_res_id, + serviceId: breakfast_id, + orderDate: new Date("2023-06-02"), + quantity: 9, + totalPrice: 450.00, + status: "Zrealizowane", + comments: "Śniadania na cały pobyt" + }, + { + guestId: thomas_id, + reservationId: thomas_res_id, + serviceId: parking_id, + orderDate: new Date("2023-05-20"), + quantity: 3, + totalPrice: 120.00, + status: "Zrealizowane", + comments: "Miejsce blisko wejścia" + }, + { + guestId: sophie_id, + reservationId: sophie_res_id, + serviceId: massage_id, + orderDate: new Date("2023-08-04"), + quantity: 2, + totalPrice: 400.00, + status: "Potwierdzone", + comments: "Masaż dla pary" + }, + { + guestId: katarzyna_id, + reservationId: katarzyna_res_id, + serviceId: bike_id, + orderDate: new Date("2023-10-02"), + quantity: 1, + totalPrice: 50.00, + status: "Oczekujące", + comments: "Rower damski" + }, + { + guestId: erik_id, + reservationId: erik_res_id, + serviceId: transfer_id, + orderDate: new Date("2023-11-15"), + quantity: 1, + totalPrice: 120.00, + status: "Potwierdzone", + comments: "Transfer na lotnisko po pobycie" + } +]); +// Indeksy +db.rooms.createIndex({ roomNumber: 1 }, { unique: true }); +db.guests.createIndex({ lastName: 1, firstName: 1 }); +db.reservations.createIndex({ checkInDate: 1, checkOutDate: 1 }); +db.reservations.createIndex({ roomId: 1 }); +db.reservations.createIndex({ guestId: 1 }); +db.services.createIndex({ category: 1, price: 1 }); +db.serviceOrders.createIndex({ serviceId: 1 }); +db.employees.createIndex({ department: 1, position: 1 });