- Reference >
- Operators >
- Query Modifiers >
- $query
$query¶
-
$query¶ The
$queryoperator provides an interface to describe queries. Consider the following operation:This is equivalent to the more familiar
db.collection.find()method:These operations return only those documents in the collection named
collectionwhere theagefield equals25.Note
Do not mix query forms. If you use the
$queryformat, do not append cursor methods to thefind(). To modify the query use the meta-query operators, such as$explain.Therefore, the following two operations are equivalent:
See also
For more information about queries in MongoDB see Read Operations, Read Operations,
db.collection.find(), and Getting Started with MongoDB.