Details
Description
Problem Description
Stale reference in compass-crud plugin causes issues when re-connecting Compass
Steps to Reproduce
- Open Compass, connect to any MongoDB instance (Atlas or localhost)
- Click on a database
- click on a collection (you must view the documents of the collection)
- Disconnect
- Re-connect to the same instance
- 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
Attachments
Issue Links
- is related to
-
COMPASS-4742 Compass plugins are leaking event listeners
-
- Open
-