On this page
$comment
$comment
Note
从 v3.2 开始在
mongo
Shell 中弃用从 v3.2 开始,$comment运算符在mongo shell 中已弃用。在mongoShell 中,改用cursor.comment()。
$comment元运算符使在$query可能出现的任何上下文中将 Comments 附加到查询成为可能。
由于 Comments 会传播到profile日志,因此添加 Comments 可以使您的 Profile 数据更易于解释和跟踪。
通过以下方式之一使用$comment:
db.collection.find( { <query> } )._addSpecial( "$comment", <comment> )
db.collection.find( { <query> } ).comment( <comment> )
db.collection.find( { $query: { <query> }, $comment: <comment> } )
要将 Comments 附加到其他上下文中的查询表达式中,例如db.collection.update(),请使用$comment查询运算符而不是元运算符。
See also
$comment查询运算符