Skip to main content

What is MongoDB?

MongoDB is a document-oriented database that belongs to the NoSQL class. Instead of tables and rows (like relational DBMSs, e.g. PostgreSQL or MySQL), it stores data as documents in a JSON-like format (BSON).

MongoDB's core ideas

  • a flexible schema - documents with different structures can be stored in the same collection
  • collections instead of tables and documents instead of rows
  • a JSON structure for data, which is well suited to storing nested objects
  • a focus on horizontal scaling (sharding)

When MongoDB is a good fit

  • when data has no rigid structure
  • when the model changes often
  • when write speed matters
  • for web services, logs, analytics, microservices

A mini document example in MongoDB

json
{ "name": "Alice", "age": 27, "skills": ["mongodb", "nodejs"] }

Summary: MongoDB is a NoSQL database that stores data as documents, gives you flexibility in structure, and is a good fit for modern web applications and microservice architectures.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.