Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4741

Can't create/delete database after re-connecting Compass

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.26.1
    • Affects Version/s: 1.26.1
    • Component/s: CRUD
    • None
    • Iteration Yucca, Iteration Z
    • Not Needed

      Problem Description

      Stale reference in compass-crud plugin causes issues when re-connecting Compass

      Steps to Reproduce

      1. Open Compass, connect to any MongoDB instance (Atlas or localhost)
      2. Click on a database
      3. click on a collection (you must view the documents of the collection)
      4. Disconnect
      5. Re-connect to the same instance
      6. Create a database (fails with the db null error)

      Expected Results

      Data base is created

      Actual Results

      Database creation fails with an error "Can't read db of null"

      mongodb-compass:crud:crud-store warning: unable to count documents +0ms TypeError: Cannot read property 'db' of null
          at descriptor.value._database (/Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/mongodb-data-service/lib/native-client.js:1242)
          at descriptor.value._collection (/Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/mongodb-data-service/lib/native-client.js:1209)
          at descriptor.value.count (/Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/mongodb-data-service/lib/native-client.js:254)
          at descriptor.value (/Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/mongodb-data-service/lib/native-client.js:1324)
          at DataService.count (/Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/mongodb-data-service/lib/data-service.js:187)
          at internal/util.js:286
          at new Promise (<anonymous>)
          at bound count (internal/util.js:285)
          at /Users/sergey.petushkov/tmp/MongoDB Compass Beta 1.26.1-beta.3.app/Contents/Resources/app.asar/node_modules/@mongodb-js/compass-crud/lib/index.js:913
      

      Additional Notes

      The issue seems to be caused by compass-crud plugin keeping a reference to the old dataService. See this Slack thread for more info. Check additionally what are the other places that can cause a similar issue

            Assignee:
            sergey.petushkov@mongodb.com Sergey Petushkov
            Reporter:
            sergey.petushkov@mongodb.com Sergey Petushkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: