Dot Notation
noun
say it: “DOT noh-TAY-shun” /ˈdɑt noʊˈteɪʃən/
A way of naming a field inside another field by joining their names with dots, such as nutrition.calories.
What is dot notation in a MongoDB filter?
Dot notation names a field inside an embedded document by joining the names with dots, such as "nutrition.calories". In a filter it must be in quotes, and on an array of documents it looks inside each item.
db.recipes.find({ "nutrition.calories": { $lt: 400 } }, { _id: 0, name: 1 });
// [ { name: 'Greek Salad' }, { name: 'Miso Soup' } ]
In a sentence
- “Without quotes around it, dot notation is a syntax error in a mongosh filter.”
- “Dot notation let the filter reach calories inside each recipe's nutrition document.”
Level: Apprentice · More MongoDB terms at this level
Updated