Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31786

$concatArrays not working on existing multi array field

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.6
    • Component/s: Aggregation Framework
    • None
    • ALL
    • Hide

      Given a collection:

      Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      { _id: 1, items: [ [1, 2, 3], [4, 5, 6] ] }
      
      db.collection.aggregate([
         { $project: { items: { $concatArrays: "$items" } } }
      ])
      

      Result should be:

      Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      { _id: 1, items: [1, 2, 3, 4, 5, 6] }
      

      Result is:

      Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      { _id: 1, items: [ [1, 2, 3], [4, 5, 6] ] }
      
      Show
      Given a collection: Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml { _id: 1, items: [ [1, 2, 3], [4, 5, 6] ] } db.collection.aggregate([ { $project: { items: { $concatArrays: "$items" } } } ]) Result should be: Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml { _id: 1, items: [1, 2, 3, 4, 5, 6] } Result is: Unable to find source-code formatter for language: javscript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml { _id: 1, items: [ [1, 2, 3], [4, 5, 6] ] }
    • Query 2017-12-04

      The $concatArrays operator does not work when using a multi array field already in the collection.

      The current work around is to use $reduce with $concatArrays.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            devnopt Joel Goldfinger
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: