Communication Models
Sym-408 wk2 DQ2. 100-150 words
In NoSQL databases, there are two types of data structures used to store data: single collections and embedded documents. Explain the differences. Provide a scenario where using single collection is more relevant than using embedded documents. Provide a scenario where using embedded documents is more relevant than using single collection.
REPLIES. 75-100 WORDS
A Nicole Snipes
When it comes to what a single collection is a group of documents that have the same or similar purpose. What the collection does is acts similar to what a table does in a traditional SQL database. However, a document will be a representation of a single entity of data in a database (InformIT, 2014). Also, an embedded document is a document that is a document contained within another document. This means when a collection has a document, then a document contains another document which contains another sub-document, and so on (GeeksforGeeks, 2021). When dealing with two types of structure that NoSQL has and which one to use over the other, it’s simple. When you are retrieving data that is related together that is when it is best to use embedded documents then single collections. The reason is that when you use the embedded documents style all the data that you want in one query can be accessed at one time by the data being embedded together in a query. A single collection would only be needed when you want to retrieve a single form of data and not as often (MongoDB, 2023). An example would be when you want to retrieve employees’ full profile information without a single collection then you can embed the information together to bring it up all at once. So instead of just getting name, address, and phone, you can then get name, address, phone, email, employee number, and so on when retrieving information.
B Trevor Stoutt
Single collections- this type of data structure refers to a group of independent documents that are stored as a single collection. There is a primary key associated with each document, this type of data structure is often used when the documents have no relation to each other (n.d.,2021).
Embedded documents- this type of data structure is used when there are relationships between multiple documents. This type of data structure is more efficient since it embeds data into a single document from multiple sources, this allows optimal retrieval of data and is less work for the data base to complete since it only has to look in a single place for the information (n.d.,2021)
A situation where using a single collection may make more sense is when there is a databases made up of different part numbers, but you only want to retrieve information about a single part.
A scenario where embedded documents may be better is when looking up information about a part in database, you also want all related information such as vendor name, location, date of manufacturer, etc..
C Joshua Victor Kirabo Kisaku
Single Collections refer to a separate collection for each type of data. (Robinson, 2022)
Embedded document or nested documents are those types of documents which contain a document inside another document. (Saini, 2021)
Differences between the two include:
· Structure: Single collections store data in distinct collections for each type of data while embedded documents store related data in a single document.
· Scalability: Embedded documents are restricted by the size of a single document, whereas single collections provide for horizontal scaling by distributing data over numerous platforms.
· Query Efficiency: Single collections need many searches to retrieve related data while embedded documents enable for faster and more efficient retrieval of related data in a single query.
· Data growth: Single collections are better equipped to handle enormous volumes of data that are anticipated to continue growing while embedded documents have a restriction on the size of a single document,
When you need to represent a significant quantity of data and expect the data to continue to increase, using standalone collections is more appropriate than using embedded documents. Single collections make it easier to handle bigger data sets by allowing you to grow horizontally by dispersing the data over numerous devices.