$exists and $type
Check field presence and type.
Example
db.users.find({ email: { $exists: true } })
db.users.find({ age: { $type: "number" } })Exercise
Field present.
{ $: true }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.