$comment

  • $comment

Deprecated since v3.2

Starting in v3.2, the $comment operator is deprecated in themongo shell. In the mongo shell,use cursor.comment() instead.

The $comment meta-operator makes it possible to attach a commentto a query in any context that $query may appear.

Because comments propagate to the profile log, adding a commentcan make your profile data easier to interpret and trace.

Use $comment in one of the following ways:

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

To attach comments to query expressions in other contexts, such asdb.collection.update(), use the $comment queryoperator instead of the meta-operator.

See also

$comment query operator