What is a NoSQL database?
BeginnerConceptMongoDB
Answer
Short answer
NoSQL ("not only SQL") databases store data in models other than relational tables, usually with flexible schemas and horizontal scaling built in. The main types are document (MongoDB), key-value (Redis, DynamoDB), wide-column (Cassandra) and graph (Neo4j).
Types
| Type | Stores | Example | Good for |
|---|---|---|---|
| Document | JSON-like documents | MongoDB, Cosmos DB | Catalogs, profiles, content |
| Key-value | key → value | Redis, DynamoDB | Caching, sessions, counters |
| Wide-column | Rows with dynamic columns | Cassandra, HBase | Massive write volumes, time series |
| Graph | Nodes + relationships | Neo4j | Social networks, recommendations |
SQL vs NoSQL in one line
SQL: fixed schema, joins, strong transactions — great for relationships and consistency. NoSQL: flexible shape and easy scale-out — great for changing data and huge volumes. Many systems use both.
What to say in the interview
"NoSQL covers non-relational models — document, key-value, wide-column and graph — with flexible schemas and built-in horizontal scaling. MongoDB is a document database; Redis is key-value. The choice depends on data shape, query patterns and consistency needs."
More on MongoDB
What is MongoDB and how is it different from MySQL or PostgreSQL?BeginnerHow do you run MongoDB, log in and work with data?BeginnerWhat is a document and a collection in MongoDB?BeginnerWhat is BSON?BeginnerWhat is the _id field and what is an ObjectId?BeginnerHow do you connect to MongoDB and explore databases and collections?Beginner