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

Document that autoCreate defaults to true and is OK for production #11205

Closed
joebowbeer opened this issue Jan 10, 2022 · 1 comment
Closed

Document that autoCreate defaults to true and is OK for production #11205

joebowbeer opened this issue Jan 10, 2022 · 1 comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation

Comments

@joebowbeer
Copy link
Contributor

joebowbeer commented Jan 10, 2022

Aside from the migration guide, which says that autoCreate now defaults to true except in some secondary cases, the Schema Options documentation has not been updated.

https://mongoosejs.com/docs/guide.html#autoCreate

Unfortunately, createCollection() cannot change an existing collection. For example, if you add capped: 1024 to your schema and the existing collection is not capped, createCollection() will throw an error. Generally, autoCreate should be false for production environments.

Unlike autoIndex, autoCreate is false by default. You can change this default by setting mongoose.set('autoCreate', true);

From:

So documentation should mirror that case then and be not so strict on not using autoCreate in prod :)

Originally posted by @deser in #8814 (comment)

@IslandRhythms IslandRhythms added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Jan 10, 2022
@vkarpov15 vkarpov15 added this to the 6.1.9 milestone Jan 13, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.2.2, 6.2.3 Feb 16, 2022
@vkarpov15
Copy link
Collaborator

This was fixed with #11116 with b0edb07

@vkarpov15 vkarpov15 removed this from the 6.2.3 milestone Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

No branches or pull requests

3 participants