[COMPASS-7320] Document Count UI Not Updating When Inserting Document from NodeJS Created: 10/Oct/23 Updated: 27/Oct/23 Resolved: 11/Oct/23 |
|
| Status: | Closed |
| Project: | Compass |
| Component/s: | None |
| Affects Version/s: | 1.40.2 |
| Fix Version/s: | No version |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | Sacha Davidson | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
OS: Windows 10 Home |
||
| Attachments: |
|
| Documentation Changes: | Not Needed |
| Description |
Problem Statement/RationaleWhat is going wrong? What action would you like the Engineering team to take? Please be sure to attach relevant logs with any sensitive data redacted. Steps to ReproduceHow could an engineer replicate the issue you’re reporting? 1. Open a collection in Compass GUI and remain on the Documents tab for the collection (note the number of documents) 3. Click 'Refresh documents' in the Compass GUI Expected Results1. The newly inserted document appears along with any previously existing documents. 2. The count of documents increases where it is displayed next to the 'Refresh documents'. Actual Results1. The newly inserted document appears along with any previously existing documents. 2. The count of documents increases where it is displayed next to the 'Refresh documents'. Additional NotesThis is my first Jira ticket outside of school, but I hope it is helpful. This was also my very first time using the Compass GUI (and the second time using MongoDB). My instructor recommended reporting the issue, in case this was not the intended behaviour. |
| Comments |
| Comment by Le Roux Bodenstein [ 11/Oct/23 ] |
|
Hi Sacha This is unfortunately "by design". The number top-right comes from collection metadata (see https://github.com/mongodb-js/compass/blob/af2e74e30317d540de266db5ca5f43194ef60d21/packages/data-service/src/data-service.ts#L958), ie. the same as if you do db.collection.estimatedDocumentCount() and this can be out of sync. To get an accurate document count you can use db.collection.countDocuments(), however that might do a collection scan which can be slow in some situations which is why compass doesn't use that there. |
| Comment by PM Bot [ 10/Oct/23 ] |
|
Hello sacha@davidson.solutions, thank you for reaching out to us! The team will review your issue and get back to you soon as soon as possible. Please review your issue to ensure you've included your environment details and have attached relevant logs (with any sensitive data redacted), so that we're best able to provide you a timely and thorough response. Thanks again! |