Skip to content
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

Allow importing Mongoose without any MongoDB specifics #13902

Closed
wants to merge 8 commits into from

Conversation

vkarpov15
Copy link
Collaborator

Summary

We've been using this branch to make Mongoose playground work: https://github.com/mongoosejs/mongoose-playground/blob/b6032ccbbf11908ae45cfc8eb28077a5559bfbdf/package.json#L13 because otherwise there's no way to import fully fledged Mongoose in the browser.

This change is more a refactor than anything, but it is sufficiently significant that I wanted to hold off until Mongoose 8.

Examples

@vkarpov15 vkarpov15 added this to the 8.0 milestone Sep 26, 2023
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i understand correctly, basically lib/index.js was moved to lib/mongoose.js and replaced with a shim for mongodb as the default driver

maybe consider adding some documentation on how to use it now without the mongo driver.

also consider cleaning up the git commits so that index.js -> mongoose.js is actually picked-up as a rename, this would mean not losing git history (blame) for the lines and also would make reviewing this pr a lot easier.

also with this change i think ESM compat will need to be tested again (wasnt this added at some point in time?)

@vkarpov15
Copy link
Collaborator Author

You're right, the general idea is that lib/index.js is renamed lib/mongoose.js, with removal of Mongoose.prototype.mongo.

Re: ESM compat, that logic is in index.js, not lib/index.js, so shouldn't be affected.

@vkarpov15
Copy link
Collaborator Author

Closing this in favor of #13905, same thing but with cleaner git history

@vkarpov15 vkarpov15 closed this Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants