What format are filters defined in in MongoDB?
Filters in MongoDB are defined as a JSON-like object, where the key is the field's name and the value is the search condition.
A simple filter example:
js
{ age: 25 }An example with an operator:
js
{ age: { $gt: 18 } }An example with a nested field:
js
{ "address.city": "Berlin" }In short: a filter is an ordinary object in the form key → condition, passed into CRUD methods (find, update, delete, etc.).
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.