OPTIONS
翻译或纠错本页面

$query

$query

The $query operator provides an interface to describe queries. Consider the following operation:

db.collection.find( { $query: { age : 25 } } )

This is equivalent to the more familiar db.collection.find() method:

db.collection.find( { age : 25 } )

These operations return only those documents in the collection named collection where the age field equals 25.

注解

Do not mix query forms. If you use the $query format, do not append cursor methods to the find(). To modify the query use the meta-query operators, such as $explain.

Therefore, the following two operations are equivalent:

db.collection.find( { $query: { age : 25 }, $explain: true } )
db.collection.find( { age : 25 } ).explain()

参见

For more information about queries in MongoDB see 读操作, db.collection.find(), and MongoDB 快速入门.

←   $snapshot $natural  →
ON THIS PAGE