Explain document-based NOSQL system with example.
Document Databases
- Document databases, like JSON (JavaScript Object Notation) objects, store data in documents. Each document has a set of field and value pairs. The values might be of many sorts, such as texts, integers, Booleans, arrays, or objects, and their structures are usually aligned with the objects that developers interact with within code.
- Document databases are useful for a broad number of use cases and may be utilized as a general-purpose database due to their variety of field value types and strong query languages. They can expand out horizontally to accommodate enormous data volumes.
- A document database is a type of NoSQL database that stores data as JSON documents instead of columns and rows. JSON is a native language used to both store and query data. These documents can be grouped together into collections to form database systems.
Each document consists of a number of key-value pairs.
Here is an example of a document that consists of 4 key-value pairs:
{
"ID" : "001",
"Book" : "Java: The Complete Reference",
"Genre" : "Reference work",
"Author" : "Herbert Schildt",
}
Using JSON enables app developers to store and query data in the same document-model format that they use to organize their app’s code. The object model can be converted into other formats, such as JSON, BSON, and XML.
OR,
Document-based NOSQL system
Document-based NOSQL DB stores and retrieves data as a key value pair but the value part is stored in JSON (Javascript object Notation ) or ML. Each document contains pairs of fields and values. The value can typically be a variety of types including like strings, numbers, booleans, arrays, or objects.
Consider the below example that shows a sample database stored in both Relational and document databases.
Document Database
F_name;"Marry ",
L_name: "Jones",
Contact: "1234567890"
City:"London",
DOB: 1986,
Location:{
type: "Point",
Coordinates: "[-73.986, 40.754]
},
Profession: [ "Developer", "Engineer"]
apps:[
{ name:"MYAPP",
version: 1.04},
{ name: "DocFinder",
version: 2.57}
],
Cars:[
{ Make:"Bently",
Year : 1973},
{ Make: " Rolls Royce",
Year: 1965}
]
Comments
Post a Comment