Current Requirements and Database Structure
Comic Crusaders want to have their presence online. They are one of the largest retailer of comic books from United States and United Kingdom. They want to know the feedback from the customers for each comic book: They decided to store comic books details and reviews given by the customer in MongoDB. They have also stored the details of the publishers of each comic book.
As per their current requirement database has been created. Following is the structure of it:
We have created comic_crusaders database. In the database new collection has been created -comics to accumulate the details of the comics, reviews and publishers. Separate document has been created for every comic.
Comic document have the following fields:
- comicid: It is a compulsory field so that each comic is uniquely acknowledged or recognized by its number.
- title: Name of the comic is stored in this particular field.
- series_title: Comics can be from one of the series. If it is from the series then its series title is mentioned else it’s left blank.
- date_of_publication: Each comic is published in a particular year which is stored in this particular field.
- physical_description: Some comics contains the physical description which is stored in this particular field else it’s left blank.
- topics: Some of the comics have keywords i.e. to which category they belong to.
- language: In this field the language in which comic is present is stored. Default language is English.
- publisher: This field contains various sub fields to store the details of associated publisher:
- pubid: To uniquely identify each publisher this field is used.
- publishername: Name of the associated publisher is stored.
- place_of_publication: Presence of publisher’s city is stored.
- country: Presence of publisher’s country is stored.
- reviews: Some of the customers have provided reviews along with ratings to some of the comics which are to store in this field having sub fields mentioned below. Some of the comics can have reviews: multiple, one or none.
- reviewedby: Customers who provide the name to the retailer gives the reviews which is stored in this particular field.
- date: Date on which a particular review has been given is stored in this field.
- rating: Customers have also provided the ratings (based out of 10) to the comic books which is stored in this field.
- comments: Customers can provide their comments which are stored in this field.
As stated above the various fields for storing the detailed information, find below the database structure in its support
“comicid” : NumberInt(16862216),
“title” : “Rise of incarnates”,
“series_title” : “”,
“date_of_publication” : NumberInt(2014),
“physical_description” : “”,
“topics” : “Science fiction, strips”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(6),
“publishername” : “Marvel Worldwide”,
“place_of_publication” : “”,
“country” : “United States”
}
],
“reviews” : [
{
“reviewedby” : “Joe”,
“date” : “6/15/2017”,
“rating” : NumberInt(9),
“comments” : “The best ever!”
},
{
“reviewedby” : “Sam”,
“date” : “6/12/2017”,
“rating” : NumberInt(8),
“comments” : “”
},
{
“reviewedby” : “Sandy”,
“date” : “6/11/2017”,
“rating” : NumberInt(10),
“comments” : “Couldn’t put it down.”
}
]
},
{
“comicid” : NumberInt(16881104),
“title” : “Star Wars adventures”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “”,
“topics” : “Star Wars, strips, Juvenile literature, Puzzles”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(2),
“publishername” : “Egmont”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(16556832),
“title” : “DC Comics fact files”,
“series_title” : “Eaglemoss collections”,
“date_of_publication” : NumberInt(2014),
“physical_description” : “colour illustrations, 29 cm”,
“topics” : “Superheroes,DC Marvel”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(1),
“publishername” : “Eaglemoss”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17004170),
“title” : “Doctor Who comic”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 30 cm”,
“topics” : “Doctor Who”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(12),
“publishername” : “Titan Comics”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Howie”,
“date” : “6/9/2017”,
Fields for Storing Detailed Information
“rating” : NumberInt(7),
“comments” : “”
}
]
},
{
“comicid” : NumberInt(17035085),
“title” : “Marvel Avengers assemble”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 30 cm + various pieces”,
“topics” : “Avengers, Juvenile fiction, Heroes”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(9),
“publishername” : “Panini UK”,
“place_of_publication” : “Kent”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Jon”,
“date” : “6/10/2017”,
“rating” : NumberInt(9),
“comments” : “Well written”
},
{
“reviewedby” : “Jess”,
“date” : “6/1/2017”,
“rating” : NumberInt(8),
“comments” : “”
}
]
},
{
“comicid” : NumberInt(17099977),
“title” : “Marvel play time!”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 30 cm”,
“topics” : “Superheroes, Juvenile literature, Puzzles”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(9),
“publishername” : “Panini UK”,
“place_of_publication” : “Kent”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17113731),
“title” : “Batman Arkham”,
“series_title” : “”,
“date_of_publication” : NumberInt(2014),
“physical_description” : “26 volumes, colour illustrations, 26 cm”,
“topics” : “Batman, superheroes”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(12),
“publishername” : “Titan Comics”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Amanda”,
“date” : “6/13/2017”,
“rating” : NumberInt(9),
“comments” : “Amazing. Can’t wait to read more”
}
]
},
{
“comicid” : NumberInt(17117137),
“title” : “Lego elves”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 30 cm”,
“topics” : “Elves, Juvenile literature”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(4),
“publishername” : “Immediate Media”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Manni”,
“date” : “6/11/2017”,
“rating” : NumberInt(8),
“comments” : “”
}
]
},
{
“comicid” : NumberInt(17117357),
“title” : “Marionette”,
“series_title” : “”,
“date_of_publication” : NumberInt(2013),
“physical_description” : “chiefly colour illustrations, 30 cm”,
“topics” : “Revolutions, Fiction, Gender identity”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(5),
“publishername” : “Kelpie Comics”,
“place_of_publication” : “Leeds”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Mitch”,
“date” : “6/9/2017”,
“rating” : NumberInt(5),
“comments” : “Was ok, could have been better”
}
]
},
{
“comicid” : NumberInt(17118168),
“title” : “Batman Superman”,
“series_title” : “”,
“date_of_publication” : NumberInt(2013),
“physical_description” : “chiefly colour illustrations, 26 cm”,
“topics” : “Batman, Superman, Superheroes”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(12),
“publishername” : “Titan Comics”,
Comic Document Fields
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Matt”,
“date” : “6/7/2017”,
“rating” : NumberInt(9),
“comments” : “Brilliant”
},
{
“reviewedby” : “Lynda”,
“date” : “6/5/2017”,
“rating” : NumberInt(10),
“comments” : “Graphics were great. Loved it”
},
{
“reviewedby” : “Eve”,
“date” : “6/13/2017”,
“rating” : NumberInt(10),
“comments” : “Such a great series”
}
]
},
{
“comicid” : NumberInt(17190726),
“title” : “Transformers : robots in disguise”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “illustratons (colour), 34 cm”,
“topics” : “Transformers”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(11),
“publishername” : “Signature”,
“place_of_publication” : “Surrey”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17359132),
“title” : “Harlem heroes”,
“series_title” : “”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “illustrations (black and white), 26 cm”,
“topics” : “Sports teams”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(10),
“publishername” : “Rebellion”,
“place_of_publication” : “Oxford”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17403656),
“title” : “Big thunder mountain railroad”,
“series_title” : “Disney kingdoms”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 26 cm”,
“topics” : “Adventure stories, American”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(6),
“publishername” : “Marvel Worldwide”,
“place_of_publication” : “”,
“country” : “United States”
}
],
“reviews” : [
{
“reviewedby” : “Stuart”,
“date” : “6/11/2017”,
“rating” : NumberInt(6),
“comments” : “”
}
]
},
{
“comicid” : NumberInt(17473663),
“title” : “Doire 2030”,
“series_title” : “”,
“date_of_publication” : NumberInt(2014),
“physical_description” : “colour illustrations, 26 cm”,
“topics” : “”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(8),
“publishername” : “NN Comics”,
“place_of_publication” : “Derry”,
“country” : “Northern Ireland”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17593604),
“title” : “Disney Whisker Haven tales with the palace pets”,
“series_title” : “Palace Pets”,
“date_of_publication” : NumberInt(2016),
“physical_description” : “chiefly colour illustrations, 28 cm + various pieces”,
“topics” : “Disney princess, Palace pets, Pets, Fantasy fiction, Juvenile literature, Puzzles”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(2),
“publishername” : “Egmont”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17596433),
“title” : “Midnight tea”,
“series_title” : “”,
“date_of_publication” : NumberInt(2016),
“physical_description” : “chiefly illustrations (black and white), 21 cm”,
“topics” : “Supernatural, Fantasy fiction, Ghost stories,”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(7),
Publishers Details
“publishername” : “Neptune Factory”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17607343),
“title” : “Lego Nexo knights”,
“series_title” : “”,
“date_of_publication” : NumberInt(2016),
“physical_description” : “chiefly colour illustrations, 30 cm”,
“topics” : “LEGO toys, Knights, Juvenile fiction”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(4),
“publishername” : “Immediate Media”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17630885),
“title” : “Tales from the Tardis”,
“series_title” : “Doctor Who”,
“date_of_publication” : NumberInt(2015),
“physical_description” : “chiefly colour illustrations, 26 cm”,
“topics” : “Doctor Who, Science fiction”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(12),
“publishername” : “Titan Comics”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(17746354),
“title” : “Sleep”,
“series_title” : “”,
“date_of_publication” : NumberInt(2016),
“physical_description” : “chiefly colour illustrations, 24 cm”,
“topics” : “Zombies, Fantasy”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(3),
“publishername” : “George A Gechev”,
“place_of_publication” : “London”,
“country” : “England”
}
],
“reviews” : [
]
},
{
“comicid” : NumberInt(16227695),
“title” : “Teenage mutant ninja turtles”,
“series_title” : “”,
“date_of_publication” : NumberInt(2013),
“physical_description” : “colour illustrations, 30 cm”,
“topics” : “Teenage Mutant Ninja Turtles, Heroes”,
“language” : “English”,
“publisher” : [
{
“pubid” : NumberInt(9),
“publishername” : “Panini UK”,
“place_of_publication” : “Kent”,
“country” : “England”
}
],
“reviews” : [
{
“reviewedby” : “Carly”,
“date” : “6/8/2017”,
“rating” : NumberInt(9),
“comments” : “Wow! Loved it.”
}
]
By default mongodb creates a new field “_id” storing ObjectId for every single document.
According to current scenario, unique index has been created on comicid so that each comic is provided with the unique identification. It is by default in ascending order. It helps dealer to maintain the records easily. At the time of any query the records can be searched easily and quickly.
In MongoDB, another index on field _id is created automatically. _id is used for memory allocation for every single document of the collection.
Indexes available are:
{
“v” : 1,
“key” : {
“_id” : 1
},
“name” : “_id_”,
“ns” : “comic_crusaders.comics”
},
{
“v” : 1,
“unique” : true,
“key” : {
“comicid” : 1
},
“name” : “comicid_1”,
“ns” : “comic_crusaders.comics”
}
In MongoDB, relationships are maintained by 2 approaches: Referenced and Embedded.
In Reference approach various collections are created and reference to another document is stored in one document where as in embedded approach only single collection is maintained and the associated data is stored in the form of array in the same document.
Reviews Details
As per the current scenario mentioned we have created relationships for publisher and reviews for each comic. We have implemented embedded approach in this particular database. Publishers details and all reviews and ratings are stored in single document. In case of no reviews the details are left blank.
“_id” : ObjectId(“59be0a42d3672738dd5ee61d”),
“comicid” : 17403656,
“title” : “Big thunder mountain railroad”,
“series_title” : “Disney kingdoms”,
“date_of_publication” : 2015,
“physical_description” : “chiefly colour illustrations, 26 cm”,
“topics” : “Adventure stories, American”,
“language” : “English”,
“publisher” : [
{
“pubid” : 6,
“publishername” : “Marvel Worldwide”,
“place_of_publication” : “”,
“country” : “United States”
}
],
“reviews” : [
{
“reviewedby” : “Stuart”,
“date” : “6/11/2017”,
“rating” : 6,
“comments” : “”
}
]
According to above mentioned scenario comic details along with its publisher and its ratings & reviews are creating the one document. In this publisher is embedded which contains its details as well as reviews shared by customers are also embedded.
As we already aware of that there are two approaches for relationships. In current scenario embedded approach of relationship is being implemented. As per the current trend or requirement or for better understanding I would prefer another approach i.e. referenced. The main drawback of the approach implemented is to maintain huge data into a single collection. In referenced model the data is relationship is normalized form. It can handle the large number of data.
In referenced, different collections have to be created:
- Comics – Comic’s details. It should store ComicID, Title, Series title, Date of publication, PubID, Physical description, Topics, Languages, PubID_Ref.
- Publishers – Details of various publishers. It should store PubID, PublisherName, Place of publication, Country.
- Reviews – Ratings and reviews of the comics. It should store ComicID, ReviewedBy, Date, Rating, Comments.
Comics:
“comicid” : NumberInt(17746354),
“title” : “Sleep”,
“series_title” : “”,
“date_of_publication” : NumberInt(2016),
“physical_description” : “chiefly colour illustrations, 24 cm”,
“topics” : “Zombies, Fantasy”,
“language” : “English”,
“publisher” : [
ObjectId(“98fft4g5d85482609a000401”)
],
“reviews” : [
ObjectId(“88fft4g5d85482609a000401”)
]
Publishers:
“pubid” : 8,
“publishername” : “NN Comics”,
“place_of_publication” : “Derry”,
“country” : “Northern Ireland”
Reviews:
“comicid” : NumberInt(17746354),
“reviewedby” : “Stuart”,
“date” : “6/11/2017”,
“rating” : 6,
“comments” : “”
Separate information that can be alluded to from numerous spots into its own particular accumulation. In the event that many records will allude to similar information it is more proficient and less mistake inclined to refresh a solitary record and keep references to it in different spots. The utilization of reference approach require an additional inquiry for read operation and consequently influence execution. In referenced model the information is relationship is standardized shape. It can deal with the substantial number of information. For data that ought to be repeated across finished many files, it can be helpful to have them in their own particular distinctive record. This can diminish botches and help in keeping the data dependable (while recollecting that various record invigorates are not atomic).
Moreover, if you figure you’re introduced reports may outperform the record gauge limit constrained by MongoDB, by then you’ll need to store a couple of data in free chronicles.
Downside of this approach is that mind boggling inquiries is to be made for accomplishing the outcomes. In the event that any control like erasure is to be done at that point comparing subtle elements from different accumulations should be erased.
Subsequent to examining the necessity I might want to prescribe couple of situations or things to Comic Crusaders. They should store the points of interest of their important clients like client name, road, city, state, nation, telephone number, email address for further reference. They should show the appraisals and audits of the every comic book accessible. They ought to likewise incorporate funnies on another dialects. Before distributing the surveys on the site they should direct the audits given by the clients. They ought to guarantee that the funnies are accessible with them. Customers ought to give the appraisals and surveys to every comic they have perused. Each comic or publisher should be distinctive. Implementation of the site ought to be alluring or great. Year of production ought to be put away. They ought to likewise begin giving the news and updates on their site including most recent discharges. Keywords for every comic ought to be put away so it is accessible through the web crawler. Customers ought to have the capacity to look through the funnies on the premise of the distributers for giving appraisals and audits.
References
Anon., n.d. Aggregations in MongoDB by Example. [Online]
Available at: https://www.compose.com/articles/aggregations-in-mongodb-by-example/
Anon., n.d. MongoDB nosql document database. [Online]
Available at: https://www.tutorialspoint.com/mongodb/mongodb_tutorial.pdf
Anon., n.d. MongoDB Tutorial. [Online]
Available at: https://www.dbschema.com/MongoDB-Tutorial.pdf
Anon., n.d. MongoDB::Examples. [Online]
Available at: https://search.cpan.org/dist/MongoDB/lib/MongoDB/Examples.pod#$project_and_$unwind
Chodorow, K., n.d. MongoDB: The Definitive Guide. s.l.:s.n.
Edward, S. G. & Sabharwal, N., n.d. Practical MongoDB. s.l.:Apress.
Glover, R., n.d. MongoDB Queries and Projections. [Online]
Available at: https://themeteorchef.com/tutorials/mongodb-queries-and-projections
[Accessed 28 August 2015].
Hows, D., Plugge, E., Membrey, P. & Hawkins, T., n.d. The Definitive Guide to MongoDB. s.l.:Apress.
Membrey, P., Hows, D. & Plugge, E., n.d. MongoDB Basics. s.l.:s.n.
Seguin, K., n.d. The Little MongoDB Book. [Online]
Available at: https://openmymind.net/mongodb.pdf