Skip to content

Query without a keyBy #49

Closed
Closed

Description

@samwillis

As we materialise a query into a collection, the results need to be keyed - currently this requires a keyBy clause int he query:

useLiveQuery((q) =>
  q
    .from({ collection })
    .where(`@age`, `>`, 30)
    .keyBy(`@id`)  // <--- current required, but we want to drop in many cases
    .select(`@id`, `@name`)
)

We should be able to drop this for a large number of queries:

  • basic queries without a join (we may be able to infer a key for some join types)
  • groupBy can use the column values for the group by to make a default key

A good starting point is to infer a key for single collection queries with only where and select - we can then move on to other cases.

Activity

  1. KyleAMathews commented on Jun 9, 2025

    @KyleAMathews
    Collaborator

    Fixed by #144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions