Docs 菜单
Docs 主页
/
MongoDB Manual
/ / /

美元发表评论

$comment

注意

自 v3.2 起已弃用

从 v 3开始。 2 , $comment操作符在mongosh中已弃用。在mongosh中,请改用 cursor.comment()

通过$comment元操作符,可以在任何可能出现$query的上下文中将注释附加到查询。

由于注释会传输到 profile 日志,因此添加注释可使配置文件数据更易于解释和跟踪。

通过以下方式之一使用$comment

db.collection.find( { <query> } )._addSpecial( "$comment", <comment> )
db.collection.find( { <query> } ).comment( <comment> )
db.collection.find( { $query: { <query> }, $comment: <comment> } )

要在其他上下文中将注释附加到表达式查询,例如db.collection.update() ,请使用$comment查询操作符而不是元运算符。

提示

另请参阅:

$comment 查询运算符

后退

查询修饰符

来年

$explain