mongodb-js / mongodb-schema

Infer a probabilistic schema for a MongoDB collection.
https://github.com/mongodb-js/mongodb-schema
Apache License 2.0
137 stars 15 forks source link

feat: export schema types, remove lodash dependency, speed up analysis COMPASS-6720 #189

Closed Anemy closed 1 year ago

Anemy commented 1 year ago

Most main changes are in src/schema-analyzer.ts which it looks like GitHub is minimizing by default.

We now export the various types so places like compass-schema and import-export can use them. In a follow up pr we'll move the gather-fields function from compass-import-export here so other places can use it (like in the wizard in compass-aggregations). https://github.com/mongodb-js/compass/blob/main/packages/compass-import-export/src/export/gather-fields.ts

These changes are a speedup, mostly from not repeating sorting on every child of a nested document. Analyzing 10000 documents from the listings fixture from compass-e2e-tests: 270 ms before, 113 ms after

Questions/Notes for reviewers:

Anemy commented 1 year ago

Merging this, going to add gather-fields and handle dots in variable names in separate prs.