







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
NOSQL BASICS| COMPUTER SCIENCE | NOSQL BASICS| COMPUTER SCIENCE |
Typology: Exams
1 / 13
This page cannot be seen from the preview
Don't miss anything!








Relational databases focus on ___ through ___. - Answer -Data consistency... transactions What data model is used by Redis, Riak, BerekleyDB and LevelDB? - Answer -Key- Value What data model is used by MongoDB, CouchDB, OrientDB and Terrastore? - Answer - Document What data model is used by Amazon SimpleDB, Cassandra, HBase and Hypertable? - Answer -Column-Family What data model is used by FlockDB, HyperGraphDB, Neo4J and OrientDB? - Answer - Graph NoSQL database - Answer -Generally refers to non-relational databases; databases that store and manipulate data in formats other than tabular relations Common characteristics of NoSQL databases - Answer -1. Provide data models that better fit application needs, reducing mapping and data between applications and databases
T or F: In a key-value database, you can have two rows with the same key. - Answer - FALSE; keys are unique. You can never have two rows with the same key. In a key-value database, you can not perform queries on the ___. - Answer -Values; you cannot select a key-value pair using the value part. ___ can be image names, web page URLs, file paths and SQL queries that point to ___ like binary images, HTML web pages, PDF documents or SQL query results. - Answer - Keys... values A key-value database is indexed by the ___. - Answer -Key What are the operations that application developers use to access and manipulate a key-value store? - Answer -PUT, GET and DELETE Key-value databases do not care about the ___ that are stored. It is the responsibility of ___ to understand what is stored. - Answer -Values... application Document databases - Answer -* Store data in structured documents, usually XML, JSON and BSON formats
How is data for a specific column family stored in a specific column-family database? - Answer -Data is stored together on a disk to optimize disk input/output operations, with the assumption that data for a particular column family will be usually accessed together. What is the advantage and disadvantage of storing data for a specific column family on a single disk? - Answer -The advantage is that we can easily access and retrieve all values of a certain column family. The disadvantage is that retrieving all attributes pertaining to a single record becomes more difficult because different column families can be stored in different machines. T or F: In a column-family database, you do not need to fully design your data model before you begin inserting data. - Answer -TRUE; columns are dynamically created upon insertion of new data. In this way, column family databases are similar to key- value stores. Unlike relational databases, you do not have to insert data in to all ___ for each ___ when using column-family databases. - Answer -Columns...row What allows column-family databases to contain tables that are sparse (i.e. do not contain values at the intersection of each row and column)? - Answer -The fact that, unlike relational databases, empty cells or null values in a column-family database do not consume any storage space. What serves as the key for data lookup in a column-family database? - Answer -A key (unique address used to look up the value of a cell) is formed with the following:
T or F: The query language used by Cassandra databases to form SQL-like queries does not allow joins or subqueries. - Answer -TRUE Graph Database - Answer -* Allow us to store entities (nodes) and relationships (edges) between these entities
How does MongoDB facilitate aggregation operations? - Answer -The aggregation pipeline, which is similar to Group By clause in SQL T or F: The name of the field that serves as the primary key in a MongoDB database is the same across collections. - Answer -TRUE; This is different from relational databases in which we can choose the primary key field. What is the equivalent of a table join in MongoDB? - Answer -Embedded Documents and $lookup MongoDB stores data records as ___. - Answer -BSON documents What is the maximum BSON document size? - Answer -16 megabytes MongoDB documents are composed of ___. - Answer -Field-value pairs What datatypes can the value of a field in a MongoDB BSON document be? - Answer - Any of the BSON data types, including:
T or F: Documents in a MongoDB database must have the same set of fields and datatypes must be the same across fields - Answer -FALSE; MongoDB documents do not need to have the same set of fields nor do the data types for a field need to be the same across documents. Normalized Data Models - Answer -Data model in which parent and child documents are in different collections. Embedded Data Models - Answer -Data model in which parent and child documents are in the same collection What is the key challenge in modeling a MongoDB database? - Answer -Balancing the needs of the application, the performance characteristics of the database engine and the data retrieval patterns. What is the most important thing to keep in mind when designing a MongoDB database? - Answer -The application usage of the data (i.e. queries, updates and processing of the data) What is the key decision in designing data models for MongoDB? - Answer -Choosing the structure of documents and how the applications represent the relationships between data. What are the two ways to represent the relationships between data in a MongoDB database? - Answer -1. Normalized data models
String - Answer -A MongoDB data type that represents any string of UTF-8 characters (value is given in quotes) {x: "database"} Double - Answer -A MongoDB data type that is a 64-bit floating point value (default number type) {x: 3.14} NumberInt - Answer -A MongoDB data type that is a 32-bit integer (value is given in quotes) {x: NumberInt("3")} NumberLong - Answer -A MongoDB data type that is a 64-bit integer (value is given in quotes) {x: NumberLong("3")} NumberDecimal - Answer -A MongoDB data type tat represents a 128-bit floating point value (value is given in quotes) {x: NumberDecimal("3.14")} Boolean - Answer -A MongoDB data type that is used for true or false values {x: true} Date - Answer -A MongoDB data type used to represent dates {x: new Date("01/01/2017")} ObjectID - Answer -A MongoDB data type that is used as the default type for the _id field (12-byte hexadecimal string) {x: ObjectID()} Array - Answer -A MongoDB datatype that serves as a representation of a set of values {x: ["a", "b", "c"]} Embedded Document - Answer -MongoDB document representing the value of a field {x: {title: "abc", quantity: 25}}
T or F: The MongoDB data object represents a date object in a standard ISO format, which can still be used in arithmetic operations. - Answer -FALSE; MongoDB stores dates as milliseconds since Jan. 1, 1970. The new Data() wrapper allows us to use the dates in the way described. Field names are always represented as ___. - Answer -A string Restrictions for field names in MongoDB - Answer -1. The field name _id is reserved for use as a primary key
show dbs; - Answer -When executed in Mongo shell, this command shows the existing databases use aggregations; - Answer -When executed in Mongo shell, this command allows you to switch to aggregations database and set db to agregations show collections; - Answer -When executed in Mongo shell, this command shows you the collections in the current database What is the primary access point to your MongoDB server through shell? - Answer -The global variable db to which your database connection is assigned. Upon startup, shell connects to the ___ on a MongoDB server and assigns this database connection to the ___. - Answer -Test database... global variable db How do you switch to another database in Mongo shell? - Answer -Issue the use command