title: MongoDB let variable not working in pipeline aggregation
body: <p>Hi I am trying to use a variable that I defined in let to be used in the match lookup, but it returns no results when regex is used:</p>
  
  <p>It works like this:</p>
  
  <pre><code>db.MSP_Prosper.aggregate([
      { $match: {Cleavage_score: {$gte:0.7}}},
      { $lookup: {
        from:"Uniprot_New_Entries",
        let: { order_item: new RegExp('.*' + "P62258" + '.*')},
        pipeline: [{
          $match: { Uniprot_AC : new RegExp('.*' + "P62258" + '.*')                                      
        }},
        { $project: { _id: 0,
          test: "$$order_item",
          date: { name: "$Uniprot_ID",
          date: "$Min_Max_Of_the_Ft_chain"} 
        }
      }],
         as:"cleavage_sites"
      }   
   }
  </code></pre>
  
  <p>])</p>
  
  <p>but not when I try to use same variable defined in let function:</p>
  
  <pre><code>db.MSP_Prosper.aggregate([
      {$match: {Cleavage_score: {$gte:0.7}}},
      {
      $lookup: { from:"Uniprot_New_Entries",
             let: { order_item: new RegExp('.*' + "P62258" + '.*')},
             pipeline: [
               { $match: 
                 { Uniprot_AC : "$$order_item" }
               },
               { $project: { _id: 0,
                    test: "$$order_item",
                    date: { name: "$Uniprot_ID",
                            date: "$Min_Max_Of_the_Ft_chain"} 
               }},    
             ],
             as:"cleavage_sites"
      }   
    }
  ])
  </code></pre>
  
  <blockquote>
    <p>Ultimatelly I want to replcae the "P62258" with a local variable
    $Protein_ID</p>
  </blockquote>
  
  <p>Hope you can help,
  Have tried out everything with no success.</p>