JavaScript Set 9 Flashcards
What does BSON stand for an what is it?
Stands for Binary JavaScript Object Notation (Binary JSON). It is a binary-encoded serialization format to represent data. Data in MongoDB is stored in BSON format for efficient storage and fast operations
What does it mean that MongoDB is schemaless?
Don’t need to configure database columns with types
No data definition language is required
What is the hierarchy of items in MongoDB
A MongoDB instance can have zero or more databases
A database can have zero or more collections
A collection can have zero or more documents
A document can have one or more fields
What are some facts about MongoDB documents?
- Documents in the same collection don’t have to have the same fields
- Documents are the same as records in RDBMS
- Documents can embed other documents
- Documents are addressed in the database with a unique key
How much faster is MongoDB than MySQL?
Anywhere from 2 to 10 times faster
What is indexing?
A data structure technique that allows users to quickly retrieve records from a database file. It optimizes database performance by minimizing the number of queries
What is an index?
A small table with only two columns. The first column is a copy of the primary key of a table, the second is a set of pointers that points to the address where data is saved
How are indexes in MongoDB defined and supported?
They are defined on a per collection level
They are supported on any field or sub-field within a document
What is sharding?
Distributing data across multiple servers to achieve horizontal scalability
What is a mongod?
A database instance
What are mongos?
Sharding processes. Analogous to a database router, processes all requests, decides how many and which mongods should receive the query, collates results, and sends it back to the client
What is mongo?
An interactive shell. Fully functional JavaScript environment for use with MongoDB
How many mongos do you need for a system?
You can have one mongos for the whole system no matter how many mongods you have. Or, you can have one local mongos for every client to minimize network latency
What are the limitations of MongoDB?
- No referential integrity
- Updating something in many places instead of one because of horizontal scalability
- Lack of a predefined schema meaning objects in a collection can be completely inconsisten
What does having no referential integrity mean?
Referential integrity is the relationship between tables which is managed in RDBMS by primary and foreign keys. MongoDB does not have this