Skip to content

Allow Direct Collection Addition to Queries Without Prior Registration #23

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

Open
KyleAMathews opened this issue Apr 28, 2025 · 0 comments

Comments

@KyleAMathews
Copy link
Collaborator

Problem

Currently, queries must reference collections that have been explicitly registered and assigned an ID.
While this ensures consistency and optimizations across the application, it imposes friction during prototyping and handling small, local, or component-scoped datasets.

Examples of friction:

  • Rapid prototyping where developers want to inject inline data without first registering a persistent collection.
  • One-off datasets that are only relevant to a single component or feature.
  • Temporary or ephemeral data that does not justify full lifecycle management.

This requirement slows down early development and complicates otherwise simple UI wiring.

Proposed Solution

Allow developers to directly add a standard collection into a query by instantiating a Collection inline without requiring explicit prior registration.

Proposed API Extension

const { results } = useDb()
  .from(new Collection({ id:  `unregisteredUsers`, ....}))
  .where(['@unregisteredUsers.name', 'like', 'A%'])
  .get();

Key properties:

  • .from(new Collection(...)) binds a collection instance directly into the query.
  • Inline-defined collections behave identically to registered collections.

Design Principles

  • Minimal friction for prototyping and lightweight local data injection.
  • No conceptual distinction between inline and registered collections at query construction time.
  • Encourages experimentation without requiring early system structure commitments.
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

No branches or pull requests

1 participant