$out to existing DB doesn't work if DB hasn't already been opened

XMLWordPrintableJSON

    • 5
    • Not Needed
    • None
    • Compass

      When using the $out aggregation stage to a collection in an existing DB, hitting the run button does nothing no error is shown.

      $out requires knowledge of the existing collections. $out works just fine if the DB doesn't yet exist or if it has already been opened in this Data Explorer session

      To reproduce, go to the aggregation tab for a collectio. Use a $out aggregation stage targeting any collection in an existing DB that you have NOT opened during this Data Explorer session. Notice that hitting the run button does nothing.

      In the console, you'll see the error

      TypeErrorCannot read properties of undefined (reading 'listCollections')
      
      Call Stack 
      
      child.fetch  MongoDBCompass/../collection-model/lib/model.js:393:43 
      child.eval [as fetch]  MongoDBCompass/../collection-model/lib/model.js:60:24 
      child.fetchCollections  MongoDBCompass/../database-model/lib/model.js:210:30 
      child.eval [as fetchCollections]  MongoDBCompass/../database-model/lib/model.js:50:24 
      child.getNamespace  MongoDBCompass/../instance-model/lib/model.js:465:14 
      async confirmWriteOperationIfNeeded  MongoDBCompass/../compass-aggregations/src/modules/aggregation.ts:188:36 
      async eval  MongoDBCompass/../compass-aggregations/src/modules/aggregation.ts:225:11

              Assignee:
              Sergey Petushkov
              Reporter:
              Jack Weir
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: