Skip to content
Theory · MongoDB: Documents, Queries, Embed or Reference · lesson 5 of 12

Nested fields, arrays and null

The latte's card holds more than lines like "name" and "price". A slip with its calories is pinned to it, it has a list of tags, and an order's card lists its items, each with its own quantity. A table row cannot do that, so a MongoDB filter has to look inside values. The rules here are simple, but in two places they go against intuition, and interviewers ask about both.

In this lesson

  • Nested fields
  • An array of documents and $elemMatch
  • null and a missing field
  • Common mistake
  • Key points