$comment
¶Deprecated since v3.2
Starting in v3.2, the 从v3.2开始,$comment
operator is deprecated in the mongo
shell. $comment
运算符在mongo
shell中不受欢迎。In the 在mongo
shell, use cursor.comment()
instead.mongo
shell中,请改用cursor.comment()
。
The $comment
meta-operator makes it possible to attach a comment to a query in any context that $query
may appear.$comment
元运算符可以在$query
可能出现的任何上下文中向查询附加注释。
Because comments propagate to the 由于注释会传播到profile
log, adding a comment can make your profile data easier to interpret and trace.profile
日志中,因此添加注释可以使配置文件数据更易于解释和跟踪。
Use 通过以下方式之一使用$comment
in one of the following ways:$comment
:
To attach comments to query expressions in other contexts, such as 将注释附加到其他上下文(如db.collection.update()
, use the $comment
query operator instead of the meta-operator.db.collection.update()
)中的查询表达,请使用$comment
查询运算符而不是元运算符。
See also参阅
$comment
query operator