Skip to content

feat(database): disable eager collection creation for all schemas#1553

Open
ChrisPdgn wants to merge 1 commit into
v0.16.xfrom
feat/lazy-collection-creation-v0.16.x
Open

feat(database): disable eager collection creation for all schemas#1553
ChrisPdgn wants to merge 1 commit into
v0.16.xfrom
feat/lazy-collection-creation-v0.16.x

Conversation

@ChrisPdgn

Copy link
Copy Markdown
Contributor

Summary

  • Set autoCreate: false and autoIndex: false on every Mongoose schema in the database adapter, not just views.
  • Collections are now created lazily on first write instead of at schema registration time, reducing empty collections on shared dev MongoDB clusters.
  • Index creation remains handled explicitly by Conduit's createIndexes() during schema registration.

Test plan

  • Start Conduit with MongoDB and register schemas that have no custom indexes; verify no empty collections are created until the first document insert.
  • Register a schema with custom indexes and confirm indexes are still created correctly.
  • Run findMany / findOne against a schema whose collection has not been created yet and confirm empty results are returned without errors.
  • Verify view schemas still behave correctly.

Set autoCreate and autoIndex to false on every Mongoose schema so
collections are only created on first write or explicit index creation.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant