$type

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Query filter operators

What it does

Matches a specified BSON type.

Syntax

{ field: { $type: "string" } }

Use case

Audit type drift.

$type: practical example
db.products.find({ price: { $type: "string" } })
💡 Explanation Matches a specified BSON type. When to use it Audit type drift.
Key Takeaways
  • Matches a specified BSON type.
  • Typical use: Audit type drift.