CompTIA Tech+ (FC0-U71)Data and Database FundamentalsMedium

A development team is building a mobile app and wants to store user profile data where each user document can have a different set of fields (some users have a bio, others do not) without requiring a fixed schema. Which type of database best fits this need?

  1. AFlat file with fixed-width records
  2. BDocument-based NoSQL database
  3. CSpreadsheet with locked columns
  4. DRelational database with a rigid schema
Show answer & explanation

Correct answer: B. Document-based NoSQL database

A document-based NoSQL database (such as MongoDB) stores data as flexible documents, often in JSON-like format, where each document can contain different fields without requiring every record to conform to the same schema.

Why the other options are wrong

  • A. A flat file with fixed-width records requires every record to follow the same rigid layout.
  • C. A spreadsheet with locked columns still enforces a consistent structure, unlike flexible documents.
  • D. A relational database enforces a fixed schema across all rows in a table, which does not fit varying fields.

Document-Based NoSQL Database

A non-relational database that stores data as flexible, often JSON-like documents, allowing each record to have a different structure.

  • Does not require a fixed schema like relational tables.
  • Common examples include MongoDB and CouchDB.
  • Well suited for rapidly changing or inconsistent data structures.

Memory trick: Document databases are like folders where each file can hold different papers.

More Data and Database Fundamentals questions