Content & privacy
Databases · INTERVIEW GUIDE

MongoDB & Mongoose

Document modeling, aggregation, indexes, and consistency.

Practice this topic
Filters
4 questions

What are documents, collections, BSON and ObjectId?

MongoDB & Mongoose·Data modeling

MongoDB stores records as documents, which group related field values in one JSON-like structure. A collection holds documents, and BSON is the binary encoding that supports values such as dates and ObjectIds. An ObjectId is a common identifier format with a timestamp component, but it is not an authorization mechanism or a strict business ordering guarantee.

Foundation2 min read

When should I embed data or reference it?

MongoDB & Mongoose·Data modeling

Embedding stores related data inside one document, while referencing stores a link to data in another document. Embedding makes related reads and single-document atomic updates convenient, but can duplicate data or create oversized documents. Referencing supports independently managed data at the cost of additional reads or joins.

Foundation2 min read

How do I model relationships and schema changes?

MongoDB & Mongoose·Data modeling

Data modeling describes how records relate and how the application retrieves and changes them. Schema evolution is the process of changing that structure while old data and possibly old application versions still exist. MongoDB's flexible document shape makes gradual migration possible, but compatibility still needs planning.

Foundation2 min read

What is denormalization?

MongoDB & Mongoose·Data modeling

Denormalization stores a fact in more than one place to make common reads simpler or faster. It trades extra storage and update work for fewer lookups. Some copies are historical snapshots, while others must track the current source of truth; those are different consistency requirements.

Foundation2 min read

Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.