L.11 Flashcards
Data Representation and NoSQL
What are the two main types of data representation?
Structured and unstructured data.
What is semi-structured data?
Data that does not have a strict schema but follows certain rules, like JSON or XML.
What are three examples of semi-structured data formats?
XML, JSON, YAML.
What is XML primarily used for?
As a markup language for semi-structured data representation.
What does a well-formed XML document require?
It must follow all XML syntax rules.
How is JSON different from XML?
JSON is a lightweight data-interchange format that is easier to read and write.
What are the basic data types in JSON?
Number, String, Boolean, Array, Object, Null.
What is NoSQL?
A category of databases designed for semi-structured or unstructured data.
What does NoSQL stand for?
“Not Only SQL.”
Name four types of NoSQL databases.
Key/Value Stores, Document Stores, Column-Based Stores, Graph Databases.
What type of NoSQL database is MongoDB?
Document Store.
What command lists all databases in MongoDB?
show dbs
What command connects to a specific database in MongoDB?
use <database></database>
What is the basic CRUD operation in MongoDB to retrieve documents?
db.<collection>.find()</collection>
How do you find all documents in MongoDB where ‘number’ is greater than 28790?
db.issues.find({number: {$gt: 28790}})
What operator in MongoDB returns only unique values?
distinct()
What does MongoDB’s _id field represent?
A unique identifier for each document.
What MongoDB feature is used to join collections?
Aggregation pipeline with $lookup.
What is an advantage of NoSQL databases over SQL?
Scalability and handling of unstructured data.
What is a disadvantage of NoSQL compared to SQL?
Lack of ACID compliance and complex query languages.
What are the three key characteristics of semi-structured data?
- Mixes data and metadata
- Does not have a rigid schema
- Often stored in formats like XML or JSON
What is the main advantage of JSON over XML?
JSON is lightweight, easier to read and write, and natively supported in JavaScript.
What is serialization in computing?
The process of converting an object or data structure into a format that can be stored or transmitted.
How does MongoDB handle 1-to-N relationships?
By embedding related documents as sub-elements.