What is MongoDB and how is it different from relational databases?
MongoDB is an open-source document-oriented NoSQL database. Stores data as flexible JSON-like documents (BSON) instead of rows in tables. Built for horizontal scaling and unstructured or evolving schemas.
Documents over rows — one document holds nested objects and arrays; no joins for related data.
Flexible schema — documents in the same collection can have different fields; no
ALTER TABLE.Horizontal scaling — built-in sharding across nodes; relational databases scale up.
No SQL, no joins — query API uses methods like
find();$lookuphandles join-like cases.Best for — content management, catalogs, IoT, analytics, anywhere schema evolves fast.
Name 5 differences: documents vs rows, flexible vs fixed schema, embedding vs JOINs, horizontal vs vertical scaling, collections vs tables. Know when each is appropriate — do not be biased toward MongoDB.