-
Notifications
You must be signed in to change notification settings - Fork 235
fix(import-export): Use query document count in export COMPASS-4537, COMPASS-4906 #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rrect count, fix showing undefined for filter
export default function(ns, spec) { | ||
let ret = `db.${toNS(ns).collection}.find(\n`; | ||
ret += ' ' + stringify(spec.filter, ''); | ||
ret += ' ' + stringify(spec.filter ? spec.filter : {}, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
{ | ||
...(query.limit ? { limit: query.limit } : {} ), | ||
...(query.skip ? { skip: query.skip } : {} ) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to handle a failure + add a maxTimeMs
here? Something like return undefined
and if the count is undefined we hide the number and the progress bar?
&& !query.skip | ||
) { | ||
try { | ||
const runEstimatedDocumentCount = promisify(dataService.estimatedCount.bind(dataService)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea! Maybe we could add a debug call for when it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow the amount of fixes :)
COMPASS-4537 COMPASS-4906
This PR fixes a couple bugs around import/export:
estimatedDocumentCount
errors on views and time-series collections, so now we usecountDocuments
. This is more expensive, so we could change up the ui here to either background load with a loader, or hide the count entirely. We do get to skip the count when we open the export from the export button oncompass-crud
by passing the count from the resulting query there.undefined
for an empty query (screenshot in comment).open-export
andopen-import
app registry messages/events. Previously we had both of these modals sharing the same store and subscribing to the same messages/events. Didn't really cause any issues before, but now that we're supplying the correct count we probably don't want to be duplicating a possibly expensivecountDocuments
call.