L.11 Flashcards

Data Representation and NoSQL

1
Q

What are the two main types of data representation?

A

Structured and unstructured data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is semi-structured data?

A

Data that does not have a strict schema but follows certain rules, like JSON or XML.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are three examples of semi-structured data formats?

A

XML, JSON, YAML.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is XML primarily used for?

A

As a markup language for semi-structured data representation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does a well-formed XML document require?

A

It must follow all XML syntax rules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is JSON different from XML?

A

JSON is a lightweight data-interchange format that is easier to read and write.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the basic data types in JSON?

A

Number, String, Boolean, Array, Object, Null.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is NoSQL?

A

A category of databases designed for semi-structured or unstructured data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does NoSQL stand for?

A

“Not Only SQL.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Name four types of NoSQL databases.

A

Key/Value Stores, Document Stores, Column-Based Stores, Graph Databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What type of NoSQL database is MongoDB?

A

Document Store.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What command lists all databases in MongoDB?

A

show dbs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What command connects to a specific database in MongoDB?

A

use <database></database>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the basic CRUD operation in MongoDB to retrieve documents?

A

db.<collection>.find()</collection>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you find all documents in MongoDB where ‘number’ is greater than 28790?

A

db.issues.find({number: {$gt: 28790}})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What operator in MongoDB returns only unique values?

A

distinct()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does MongoDB’s _id field represent?

A

A unique identifier for each document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What MongoDB feature is used to join collections?

A

Aggregation pipeline with $lookup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is an advantage of NoSQL databases over SQL?

A

Scalability and handling of unstructured data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a disadvantage of NoSQL compared to SQL?

A

Lack of ACID compliance and complex query languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are the three key characteristics of semi-structured data?

A
  • Mixes data and metadata
  • Does not have a rigid schema
  • Often stored in formats like XML or JSON
22
Q

What is the main advantage of JSON over XML?

A

JSON is lightweight, easier to read and write, and natively supported in JavaScript.

23
Q

What is serialization in computing?

A

The process of converting an object or data structure into a format that can be stored or transmitted.

24
Q

How does MongoDB handle 1-to-N relationships?

A

By embedding related documents as sub-elements.

25
What is an example of a Key/Value store NoSQL database?
Redis or DynamoDB.
26
What is an example of a Graph database?
Neo4j.
27
What is an example of a Column-based NoSQL database?
HBase.
28
What is an example of a Document Store NoSQL database?
MongoDB.
29
How do you retrieve all collections in a MongoDB database?
show collections
30
How do you display all documents in a MongoDB collection?
db..find().pretty()
31
What does the $size operator do in MongoDB?
Filters documents where an array field has a specific number of elements.
32
What does the $set operator do in MongoDB?
Updates specific fields in a document.
33
How do you count documents in a MongoDB collection?
db..count({query})
34
What is an aggregation pipeline in MongoDB?
A framework for data transformation and analysis using multiple stages.
35
How do you exclude the _id field in a MongoDB query result?
db.issues.find({}, { _id: false })
36
What is sharding in NoSQL databases?
A method of distributing data across multiple servers to improve scalability.
37
What are the main trade-offs of NoSQL databases?
They sacrifice strict consistency for scalability and performance.
38
What is query-by-example in MongoDB?
A querying mechanism where users specify example fields and values to match.
39
How do you update a document in MongoDB?
db..update({query}, {$set: {field: value}})
40
What is the role of MongoDB’s $lookup operator?
It allows for performing joins between collections in the aggregation pipeline.
41
What does eventual consistency mean in NoSQL?
Updates to a database may not be immediately reflected across all nodes, but will be consistent over time.
42
Why is MongoDB popular for web applications?
Its flexibility, scalability, and support for JSON-like documents make it ideal for dynamic applications.
43
What is a drawback of using NoSQL over SQL databases?
Complex transactions and consistency guarantees can be harder to manage.
44
What is a collection in MongoDB?
A grouping of MongoDB documents, similar to a table in relational databases.
45
How do you find documents in MongoDB where a field is null?
db..find({ field: null })
46
What is a primary reason to use NoSQL over SQL?
Handling large volumes of unstructured or semi-structured data.
47
How does MongoDB handle schema evolution?
MongoDB is schema-less, meaning documents in a collection do not need to follow a fixed structure.
48
What is the difference between well-formed and valid XML?
Well-formed XML follows syntax rules, while valid XML conforms to a defined schema (DTD).
49
How can you filter MongoDB documents based on a condition inside an array?
Using dot notation, e.g., db.issues.find({"labels.default": true})
50
What is the main takeaway from the lecture on NoSQL?
NoSQL databases provide scalable, flexible solutions for semi-structured and unstructured data.