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: add getSchemaPaths helper #192

Closed Anemy closed 1 year ago

Anemy commented 1 year ago

This is something we already have in Compass that we're moving here. Here's where it was in Compass (after merging and releasing this pr we'll remove it in Compass and start using it from this package): https://github.com/mongodb-js/compass/blob/892e83129ea3a33ba42c1fc1f5f094b45fd17885/packages/compass-import-export/src/export/gather-fields.ts#L36

This should also speed up how we do it in Compass as we don't need to finalize the schema to get the schema paths. The overload on the options in the stream file is a big gross, open to suggestions on how to make this a bit cleaner.