Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs 菜单
Docs 主页
/
MongoDB Manual
/ / /

$comment

$comment

注意

自 v3.2 起已弃用

从 v3.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 查询运算符

后退

查询修饰符