title: Mongo DB Shell - Multi-Line query not working
body: <p>I'm running version 3.6 of Mongo DB, and I'm using the mongo shell. I'm running it on MacOS Sierra. I'm having a lot of grief with this multi-line query. I'm copying and pasting it from Sublime Text to the Mongo Shell.</p>
  
  <p>Ok, so here is the query:</p>
  
  <pre><code>db.submissions.aggregate([
      {
          "$match": {
              "FieldValues.Value": "Craig"
          }
      },
      {
          "$lookup": {
              "from": "aliases",
              "localField": "FieldValues.Name",
              "foreignField": "Fields.Field",
              "as": "R"
          }
      },
      {
          "$unwind": "$R"
      },
      {
          "$unwind": "$R.Fields"
      },
      {
          "$unwind": "$FieldValues"
      }
  ])
  </code></pre>
  
  <p>So, let's run through the combinations of when I get errors, and when I don't</p>
  
  <p><strong>1) Run the query as-is, this is what happens in the shell:</strong></p>
  
  <pre><code>&gt; db.submissions.aggregate([
  ... {
  ... "$match": {
  ... "FieldValues.Value": "Craig"
  ... }
  ... },
  ... {
  ... "$lookup": {
  ... "from": "aliases",
  ... "localField": "FieldValues.Name",
  ... "foreignField": "Fields.Field",
  ... "as": "R"
  ... }
  ... },
  ... {
  ... "$unwind": "$R"
  ... },
  ... {
  ...     "$unwind": "$R.Fields"
  ...   },
  ...   {
  ...   
  Display all 172 possibilities? (y or n)
  ...   wind": "$FieldValues"
  2017-11-27T09:46:39.650-0500 E QUERY    [thread1] SyntaxError: missing : after property id @(shell):22:6
  &gt;   }
  2017-11-27T09:46:39.652-0500 E QUERY    [thread1] SyntaxError: expected expression, got '}' @(shell):1:0
  &gt; ])
  </code></pre>
  
  <p>I should point out that last line is my current "entry point" (I can't think of a better name for it), and my curser is at the end of the "])".</p>
  
  <p><strong>2) Run the query, just without that last "$unwind".</strong></p>
  
  <p>Everything works.</p>
  
  <p><strong>3) Run the query with the last "$unwind" on one line.</strong></p>
  
  <p>This means:</p>
  
  <pre><code>{"$unwind": "$FieldValues"}
  </code></pre>
  
  <p>Then, everything works.</p>
  
  <p><strong>Conclusion/Question</strong></p>
  
  <p>So, WTF? Why is Mongo Shell freaking out when I paste this query in pretty-printed, with that last "$unwind"?</p>
  
  <p>I should also point out it is NOT the "$unwind" itself that causes the problem. Any additional query that I put into the pipeline there causes a similar error when I paste it in.</p>