(ICT320) Database programming assignmentusing NoSQL on MongoDB platform for Luxury-Oriented Scenic Tours
Question
Task: In your database programming assignment, justify your choices for the NoSQL Document data structures you selected for each attribute in the given relational schema. Explain why you chose each of the data structures and justify these choices with your sample data set. There must be a minimum of three document collections and an array of documents. A redesigned schema (NoSQL Document Data using MongoDB) must be provided. You must also include code that inserts data into the collections. Create six distinct queries with MongoDB that uses the following methods and expressions:
I. aggregate() and $first
II. find() and regex
III. $group and $push
IV. aggregate(), $group, $sum and $sort
V. aggregate(), $group, $dateToString and $sum
VI. aggregate(), $unwind, $group and $sum
Answer
Introduction
In this database programming assignmenta comprehensive knowledge on Database programmingwill be illustrated.A foundation named Luxury-Oriented Scenic Tours (LOST) is a group that guides tourists in the Washington area and has suggested to maintain the data using NoSQL on MongoDB platform. Here, a complete analysis on database development and data management will be conducted by using MongoDB. Based on the task requirement two major questions will be addressed in this database programming assignment. In the first question it is illustrated why NoSQL is used on MongoDB platform for the given data. In the second question six queries are addressed using MongoDB platform.
Justifying choices for the NoSQL in the database programming assignment
NoSQL is a database management system which is used for storing and captivating data in a database. It is used for storing huge amount of data and is much more flexible than relational database as this platform provides much more flexibility than relational database as there is no requirement to state the schema in order to start working in the application. It is found in the database programming assignment that the NoSQL database does not put any kind of restriction on the type of data in order to start working. NoSQL databases are very adaptable and may be tailored to company's specific scalability requirements. They have the benefit of SQL databases in that they can be extended widely rather than vertically. The inability of the data to be structured is what enables NoSQL platforms to scale horizontally (Yoo, Boulware and Kimmey 2020). Every item is autonomous and self-contained since Data warehouses require less architecture than structure database system do. It is analyzed in the database programming assignmentthat each information is kept on a different server as a consequence, eliminating the requirement for linking. Here NoSQL is used because it had a lot amount of data which is needed to store in a systematic way as the organization was unable to store it and was facing challenges.
In this data management work Tour, Outing, Guide, Location, Client, Stop, Booking and Qualification is mentioned. It is found in the database programming assignment that here in this various data are stored for instance in tour it is mentioned the guides name places that are being visited and the fees of the particular places. Similarly, in guide the guides name is mentioned, in client the details of all the clients that are visiting is mentioned like the client’s name, address, phone number and city is mentioned. In stop it is mentioned which guide in taking a stop at which point of time and like this way we stored the rest of the data to find out the results very quickly and in a simple way.
Code and schema to insert data in the collections
Booking data insertion codes in the database programming assignment
{
"OUT_NUM": "O2",
"CLIENT_NUM": "C3"
}
Client data insertion codes
{
"CLIENT_NUM": "C1",
"F_NAME": "LIAM",
"L_NAME": "JONES",
"STREET ": "SILVER CANOE WAY",
"CITY": "WYLIE",
"STATE": "TX",
"ZIP": "75098",
"STATUS": "MARRIED"
}
Guide data insertion codes
{
"G_EMPID ": "G1",
" G_FIRSTNAME": "JASON",
"G_LASTNAME": "ROY",
"G_STREET": "MEDITATION LANE",
"G_CITY": "ATKINSON",
"G_STATE": "NH",
"G_ZIP": "3811",
"G_HIRE DATE": "10-01-2022"
}
Location data insertion codes
{
"LOCATION_NO": "L1",
"LOCATION_NAME": "WHITE HOUSE",
"LOCATION_TYPE": "CAPITAL",
"LOCATION_DSECRIPTION": "IT IS THE CAPITAL OF TRHE US"
}
Outing data insertion codes
{
"Out_no": "O1",
"Out_date": "04-11-2022",
"Out_time": "10:00a.m",
"Tour_num": "T2",
"G_emp_id": "G2"
}
Qualification data insertion codes
{
"QUAL_DATE": "15-02-2022",
"Tour_no": "T1",
"G_EMPID ": "G2"
}
Stop data insertion codes
{
"Tour_no": "T1",
"LOCATION_NO": "L1"
}
Tour data insertion codes
{
"Tour_no": "T1",
"TOUR_NAME": "WHITE HOUSE",
"TOUR_LENGTH(HRS)": {
"$numberLong": "1"
},
"TOUR_FEE": {
"$numberLong": "100"
}
}
Creating queries with MongoDB platform
In this section of thedatabase programming assignment, different operations on the selected database architecture has been executed on MongoDB platform. This platform gives multiple features to do advanced analysis on the given problem context. Here, number of NoSQL queries have been executed and their outcomes have also been shared.
i. In this point, aggregated function has been successfully executed on the database.
It is analyzed in this database programming assignment that aggregated function is used to produce recorded data and documents and give back computed results in return. In this scenario aggregated function is used in the Pk Booking to find out the data recorded in that particular database. By using this function, we have found the result that total fees are1100. So it can be concluded from the above data provided, it can be concluded that Booking fees total is 1100 and hence it can be concluded that by just using a simple function in MongoDB the result could be found out easily.
ii. In this point, find function has been successfully executed on the database.
Find method in MongoDB is used for selecting documents is a set of collection and return back a cursor to the documents selected. Find function is used here to find the details stored in the Pk tour under which we stored the details of the places where the clients are taken, tour length of the place that are being visited and the fees charged for the places that are being visited (Santhiya and Bhuvaneswar 2018). Hence it can be concluded from the database programming assignment that using the find function any certain amount of data can be searched within a very small period of time and it will be very easy to access whatever amount of data that is being provided.
iii. In this point, sum function has been successfully executed in the database.
Sum function is used for those data which contain both numeric and non-numeric values that are stored in the database, but sum function only returns the sum of numeric values that are stored in the system. In this scenario sum function is used for finding the total value of the tour that is charged from that database that was provided within the Pk Tour in which values were mentioned of the particular tours that were conducted (Shrivastava 2021). Hence it is found in the database programming assignment, from sum function it became very easy for us to calculate the total fees of the campaign that was conducted from the particular database. Similarly sum function can also be used in places where the sum of a huge amount of data needs to be collected and it will be very easy to find the total sum just by using a command in the database platform.
iv. In this point, sort function has been successfully executed in the database.
Sort method identifies the order followed by the query in returning the same matched documents from the collection. Here it is found in the database programming assignment,sort function is used to sort the fees that that was charged to the tourists for any particular places, for instance by using this find function and output is shown that the guide number who is taking to Washington and how much money it is charged to go in that place is found out pretty easily and also in the same way the other guides who are taking to which place and how much money is charged is clearly shown from the collection of data that we provided. Hence we can say that find function can also be used in places where a large amount is data is stored to find out the required results in an instance of time just by typing a command in the database.
Conclusion
NoSQL databases have a number of advantages over conventional relational technologies, such as a more adaptable data model, horizontal scalability, and better performance. These advantages do, however, come with some NoSQL database difficulties. The difficulty with NoSQL technology is that many of these databases are designed for specific use cases and cannot be used to address a wide range of needs inside an organization.Top advantages that NOSQL provides is that it is simple to use, has lesser codes and can be easily maintained. During this database programming assignment, few challenges have been faced which are then successfully been resolve by conducting a brief analysis on the identified problem context.
References
Santhiya, K. and Bhuvaneswari, V., 2018. An automated MapReduce framework for crime classification of news articles using MongoDB. International Journal of Applied Engineering Research, 13(1), pp.131-136.
Shrivastava, V., 2021. An Approach to Improved MapReduce and Aggregation Pipeline Utilizing NoSQL Technologies. In Proceedings of International Conference on Data Science and Applications (pp. 187-195). Springer, Singapore.
Yoo, J.S., Boulware, D. and Kimmey, D., 2020. Parallel co-location mining with MapReduce and NoSQL systems. Knowledge and Information Systems, 62(4), pp.1433-1463.