MongoDB: Why $literal required ? And where it can be used?
<p>I have gone through MongoDB <strong>$literal</strong> in <strong>Aggregation</strong> framework, but I don't understand where it could be used ? more importantly, why it is required ?</p>

<blockquote>
  <p>Example from official MongoDB documentation,</p>
</blockquote>

<pre><code>db.records.aggregate( [
   { $project: { costsOneDollar: { $eq: [ "$price", { $literal: "$1" } ] } } }
])
</code></pre>

<p>Instead of the above example using $literal, why can't I use as below ?</p>

<pre><code>db.records.aggregate( [
   { $project: { costsOneDollar: { $eq: [ "$price", "$1" ] } } }
] )
</code></pre>

<p>Also provide some other example which shows the best(or effective) usage of <strong>$literal</strong>.</p>