NoSQL Databases: Document, Key-Value, Wide-Column and Graph Interview Questions

261 multiple-choice tech interview questions on NoSQL Databases: Document, Key-Value, Wide-Column and Graph: document, key-value, wide-column and graph models, partition keys, schema design, choosing SQL or NoSQL. Written for technical phone screens and interview prep, organized by subtopic, with a short explanation for every answer. Learn the 244 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 5.1 NoSQL models and their trade-offs
  2. 5.2 Document modeling with MongoDB
  3. 5.3 MongoDB queries, indexes and operations
  4. 5.4 DynamoDB keys, indexes and single-table design
  5. 5.5 DynamoDB capacity, streams and operations
  6. 5.6 Azure Cosmos DB
  7. 5.7 Wide-column stores: Cassandra, ScyllaDB and Bigtable
  8. 5.8 Graph, time-series and search stores
  9. 5.9 Partitioning, consistency and choosing a NoSQL store

Key terms

5.1 NoSQL models and their trade-offs

Document store
A database storing semi-structured JSON-like documents, such as MongoDB or Cosmos DB
Key-value store
A database that stores opaque values looked up by key, such as Redis or DynamoDB
Wide-column store
A database organizing rows by partition key with flexible columns, such as Cassandra
Graph database
A database storing nodes and relationships for fast traversals, such as Neo4j
NoSQL
Not only SQL
NoSQL origins
Web scale
Dynamo paper
2007
Bigtable paper
2006
Document strength
Nested aggregates
Key-value limit
Key lookups only
Wide-column layout
Partitions and sorted columns
Graph data
Nodes and relationships
Index-free adjacency
Direct neighbor pointers
Property graph vs RDF
Properties vs triples
Schemaless myth
Implicit schema
NewSQL
Distributed ACID SQL
RocksDB
Embedded LSM engine
Wide-column vs columnar
Not the same
Amazon QLDB
Ended 2025
Search as source of truth
Avoid
GQL
ISO graph language
Scale-out writes
Partition by key
Varied attributes
Documents
Document weakness
Cross-document joins
Managed document stores
Atlas, DocumentDB, Firestore

5.2 Document modeling with MongoDB

Partition key
The attribute that decides which partition stores an item and spreads load
Hot partition
A partition receiving a disproportionate share of traffic and being throttled
Request unit (RU)
Cosmos DB's normalized cost of a database operation
BSON
Binary typed JSON
ObjectId
Timestamp, random, counter
_id
Unique key
One-to-squillions
Parent reference
Extended reference
Copy key fields
Subset pattern
Embed most-used
Bucket pattern
Group readings
Computed pattern
Precompute on write
Outlier pattern
Overflow documents
Polymorphic pattern
Shapes in one collection
Attribute pattern
Key-value array
$jsonSchema
Validation rules
validationAction warn
Log, allow
Query-driven design
Model for access
Many-to-many in MongoDB
ID arrays
Single-document atomicity
No transaction needed
Short field names
Stored per document
BSON Date
Sortable dates
Decimal128
Exact money
Large documents
More I/O
Ancestor array
Tree queries
Mongoose
Node.js ODM
Time series collections
Bucketed storage
Capped collection
Fixed size
Dynamic field names
Avoid

5.3 MongoDB queries, indexes and operations

$gt
Greater than
Projection
Choose fields
$elemMatch
Same element
Dot notation
Nested fields
$set
Change fields
$inc
Atomic increment
$push with $slice
Capped array
Upsert
Insert if missing
Aggregation pipeline
Stages
$match early
Filter first
$lookup
Left outer join
$unwind
One per element
ESR rule
Equality, Sort, Range
Multikey index
Array index
TTL index
Auto-expire
explain
IXSCAN vs COLLSCAN
Atlas Search
Lucene search
Replica set
Primary and secondaries
secondaryPreferred
Possibly stale reads
Read concern majority
Won't roll back
mongos
Query router
Config servers
Cluster metadata
Hashed shard key
Even inserts
Resharding
Change shard key
Transaction lifetime
60 seconds
Change streams
Change feed
Retryable writes
Safe retry
WiredTiger
Storage engine

5.4 DynamoDB keys, indexes and single-table design

Primary key types
Partition or composite
Item size
400 KB
LSI
Same PK, new SK
LSI limit
10 GB per collection
GSI consistency
Eventual only
GSI projection
Copied attributes
Sparse GSI
Only items with the key
Query vs Scan
Partition vs table
Filter expressions
Paid after read
begins_with
Sort key prefix
Item collection
Same partition key
Adjacency list pattern
Inverted GSI
Access patterns first
List them up front
Hierarchical sort key
Prefix queries
LastEvaluatedKey
Pagination
1 MB page
Before filters
ScanIndexForward
Reverse order
Counting items
Counter item
Number precision
38 digits
BatchGetItem
100 items
UnprocessedKeys
Retry with backoff
ProjectionExpression
No capacity savings
GSI write cost
Extra writes
GSI quota
20 per table
Single-table drawback
Harder to evolve
PartiQL
SQL-like access

5.5 DynamoDB capacity, streams and operations

Capacity modes
On-demand or provisioned
RCU
4 KB strong read
Eventual reads
Half cost
WCU
1 KB write
Transactional cost
Double
Throttling
Retry with backoff
On-demand price cut
November 2024
Auto scaling
Target utilization
Partition limits
3,000 RCU, 1,000 WCU
Adaptive capacity
Shifts to hot partitions
DynamoDB Streams
24-hour change log
NEW_AND_OLD_IMAGES
Before and after
Lambda trigger
Stream processing
Kinesis for DynamoDB
Longer retention
TTL
Free background deletes
TTL lag
Filter expired
attribute_not_exists
Insert if new
Unique attribute
Guard item in transaction
ClientRequestToken
Idempotent transaction
Global tables
Multi-active regions
MRSC
Strong multi-region
Export to S3
No capacity used
Zero-ETL
Synced copies
Standard-IA
Cheap storage
Contributor Insights
Hot keys
Warm throughput
Pre-warm
Encryption at rest
Always on
LeadingKeys
Per-user items
Deletion protection
Guard table

5.6 Azure Cosmos DB

Session default
Cosmos DB
Point read
About 1 RU
429
Too many requests
Logical partition limit
20 GB
Logical vs physical
Many to one
Physical partition limit
10,000 RU/s
Hierarchical partition keys
Up to three levels
Synthetic key
Combined properties
Default indexing
Everything
Excluded paths
Cheaper writes
Composite index
Multi-property ORDER BY
Change feed
Ordered changes
Change feed deletes
Soft delete or AVAD
Cosmos TTL
Auto-expire
Multi-region writes
Write anywhere
Serverless
Per-RU billing
Autoscale
10% to 100%
Free tier
1,000 RU/s, 25 GB
Transactional batch
One logical partition
Integrated cache
0-RU repeat reads
Partition key change
New container
Request charge
RU per request
Fabric mirroring
Analytics copy
Relaxed consistency
Per request
Continuous backup
7 or 30 days

5.7 Wide-column stores: Cassandra, ScyllaDB and Bigtable

Partition key and clustering
Cassandra primary key
Clustering order
Sorted within partition
Table per query
Duplicate data
ALLOW FILTERING
Possible scan
Bounded partitions
Keep them small
Time bucket
Limit growth
Tombstone
Delete marker
Tombstone pileup
Slow reads
Write path
Commit log, memtable, SSTable
TWCS
Time-series compaction
UCS
Cassandra 5.0 compaction
SAI
Secondary indexes
Lightweight transaction
Paxos
Gossip
Peer state
NetworkTopologyStrategy
Replicas per DC
LOCAL_QUORUM
Local DC majority
Hinted handoff
Replay later
Repair
Anti-entropy
Counter columns
Not idempotent
Logged batch
Multi-table sync
Upsert semantics
Overwrite
ScyllaDB
C++ Cassandra
Amazon Keyspaces
Managed Cassandra
Bigtable row key
Only index
HBase
HDFS and ZooKeeper
Materialized views
Experimental
No joins
CQL
Token-aware driver
Direct to replica

5.8 Graph, time-series and search stores

MERGE
Create if missing
Variable-length path
*1..3
shortestPath
Shortest connection
Gremlin
TinkerPop traversals
Amazon Neptune
Managed graph
Supernode
Huge degree
Graph algorithms
PageRank, communities
Labels
Node tags
Relationship direction
Always stored
Apache AGE
Cypher in PostgreSQL
Hypertable
Time chunks
Continuous aggregates
Incremental rollups
Line protocol
Measurement, tags, fields
Tags vs fields
Indexed vs values
InfluxDB 3
Arrow and Parquet
Append-optimized
Time-ordered writes
Time-series compression
Deltas
Azure Data Explorer
KQL analytics
Analyzer
Tokenize and normalize
text vs keyword
Analyzed vs exact
Refresh interval
Near real-time
Primary shard count
Fixed
search_after
Deep paging
Elastic AGPL
2024
OpenSearch Foundation
Linux Foundation
Redis 8 JSON and query
Built in
OPTIONAL MATCH
Outer join
Uniqueness constraint
No duplicate nodes

5.9 Partitioning, consistency and choosing a NoSQL store

Eventual consistency
Replicas converge if writes stop, but reads may be stale until then
Polyglot persistence
Using different databases for different needs in one system
Orders partition key
Customer ID
Async global indexes
Faster writes
Local vs global indexes
Partition vs value
JSONB instead
Joins and transactions
Request-unit costs
Scans cost
Lazy migration
Upgrade on touch
Continuation tokens
Resume pages
Emulators
Local tests
YCSB
NoSQL benchmark
Realistic key skew
Find hot partitions
Document vs graph
Multi-hop links
Search sync
Change feed
Scan guardrails
Permissions and alerts
Lock-in
Hard to port
Compatible APIs
Test features
Sharded counters
Firestore writes
Firestore offline
Local cache sync
Security rules
Firestore access
Couchbase
Document store with cache
SSPL
MongoDB license
Per-user partitions
Fast erasure
Small items
Lower cost
Normalized email key
Case-insensitive
Scan order
Not guaranteed
Version items
v0 latest

Sample practice questions

  1. Which database is a document store?

    1. Redis
    2. Apache Cassandra
    3. MongoDB
    4. Neo4j

    Answer: C. MongoDB MongoDB stores JSON-like BSON documents. Redis is key-value, Cassandra is wide-column and Neo4j is a graph database.

  2. In document modeling, when should you embed related data rather than reference it?

    1. When it grows without limit, such as every click a user ever makes
    2. When it's read together, owned by one parent and bounded, like order lines
    3. When many parents share the same item and that item changes often
    4. Always; references are never used in document database models

    Answer: B. When it's read together, owned by one parent and bounded, like order lines Embed for one-to-few data read together. Reference for unbounded, shared or independently updated data.

  3. Which statement about modern NoSQL transaction support is accurate?

    1. No NoSQL database supports transactions of any kind, even on a single document
    2. Every NoSQL database supports unlimited cross-region ACID transactions by default
    3. MongoDB has multi-document ACID; DynamoDB's TransactWriteItems spans up to 100 items
    4. Only graph databases support transactions; document and key-value stores never do

    Answer: C. MongoDB has multi-document ACID; DynamoDB's TransactWriteItems spans up to 100 items Transactions exist but have limits and costs; designs still try to keep related writes in one item or partition.

  4. In DynamoDB, what does a sort key enable?

    1. Sorting the entire table globally by any attribute you choose at query time
    2. Joining two DynamoDB tables together on matching key attributes
    3. Encrypting each item with a key derived from its sort attribute
    4. Many sorted items per partition key, with range queries like date ranges

    Answer: D. Many sorted items per partition key, with range queries like date ranges Partition key plus sort key form the primary key. Query reads one partition key's items, optionally filtered by sort key range.

  5. What are DynamoDB's two capacity modes?

    1. On-demand, billed per request, and provisioned, with set read and write units
    2. Serverless and dedicated, depending on the instance size
    3. Hot and cold, depending on how often the table is read
    4. Single-region and global, depending on replication

    Answer: A. On-demand, billed per request, and provisioned, with set read and write units You can switch modes on an existing table.

  6. Azure Cosmos DB is best described as

    1. a relational data warehouse for large analytical queries only
    2. a managed file share service mounted over SMB by VMs
    3. an in-memory cache service for session and lookup data only
    4. a globally distributed, multi-model database with several APIs

    Answer: D. a globally distributed, multi-model database with several APIs Cosmos DB also offers vector search and a PostgreSQL option (Cosmos DB for PostgreSQL, built on Citus).

  7. In Cassandra, why must queries usually include the partition key?

    1. Cassandra requires every query to be written as a join
    2. Data is spread by partition key; without it every node is scanned
    3. The partition key is also used to authenticate the caller
    4. Without it, results come back quickly but are unsorted

    Answer: B. Data is spread by partition key; without it every node is scanned Cassandra tables are designed per query. ALLOW FILTERING exists but is an anti-pattern at scale.

  8. What does Cypher, used by Neo4j, look like for "Alice's friends"?

    1. `MATCH (a:Person {name:'Alice'})-[:FRIEND]->(f) RETURN f`
    2. `SELECT f.* FROM Person a JOIN FRIEND f ON a.name = 'Alice'`
    3. `g.V().has('Person','name','Alice').out('FRIEND').values()`
    4. `db.people.find({ name: 'Alice' }, { friends: 1, _id: 0 })`

    Answer: A. `MATCH (a:Person {name:'Alice'})-[:FRIEND]->(f) RETURN f` Cypher uses ASCII-art patterns: nodes in parentheses and relationships in brackets with arrows. The other options are SQL, Gremlin and the MongoDB shell.

  9. In DynamoDB or Cosmos DB, why does choosing a good partition key matter so much?

    1. It determines the order in which fields are stored inside each document
    2. It decides which users and roles are allowed to read the data
    3. It spreads data and load evenly and lets common queries hit one partition
    4. It controls how often the database takes automatic backups

    Answer: C. It spreads data and load evenly and lets common queries hit one partition A low-cardinality or skewed key creates "hot partitions" that throttle while others sit idle.

  10. Which kind of database best fits "find friends of friends who like the same band" queries?

    1. A key-value store such as Redis
    2. A wide-column store such as Cassandra
    3. A graph database such as Neo4j
    4. A columnar data warehouse

    Answer: C. A graph database such as Neo4j Graph databases store relationships as first-class edges, so multi-hop traversals are fast.

Practice all 261 questions

More Storage and Data