Skip to content

Comments

[Improvement] Enable independent projection across collection entities#550

Open
tywalch wants to merge 2 commits intomasterfrom
improvement/enable-independent-projection-across-collection-entities
Open

[Improvement] Enable independent projection across collection entities#550
tywalch wants to merge 2 commits intomasterfrom
improvement/enable-independent-projection-across-collection-entities

Conversation

@tywalch
Copy link
Owner

@tywalch tywalch commented Feb 22, 2026

Relaxes attribute projection validation logic to allow entities to have different projection attributes. This was a constraint because the original scope of projection attributes did not include collections. By the time 3.6.0 was released, @anatolzak had done the work to enable robust collection typing, and the constraint was no longer necessary. This change removes the constraint and adds tests.

…ributes

Relaxes attribute projection validation logic to allow entities to have different projection attributes. This was a constraint because the original scope of projection attributes did not include collections. By release the time 3.6.0 was merged it had robust collection typing. This change removes the constraint and adds tests.
@netlify
Copy link

netlify bot commented Feb 22, 2026

Deploy Preview for electrodb-dev canceled.

Name Link
🔨 Latest commit 5ecedc6
🔍 Latest deploy log https://app.netlify.com/projects/electrodb-dev/deploys/699b5ac49cc20c00083650d1

@tywalch
Copy link
Owner Author

tywalch commented Feb 22, 2026

@anatolzak I am like 99% sure I imposed this constraint because the original scope didn't include collection typing, not because of any underlying implementation constraint. Lmk if you remember that and/or have any concerns.

@anatolzak
Copy link
Contributor

@tywalch looks good to me. I don't think I see any issues here.

I am like 99% sure I imposed this constraint because the original scope didn't include collection typing, not because of any underlying implementation constraint. Lmk if you remember that and/or have any concerns.

I don't recall this constraint of entity projection across entities in a collection existing due to the lack of collection typing.

According to the original scope, I implemented projection typing only for non-collection queries. From a runtime perspective, you could still add different projection attributes to the schema of the entities in a collection. I think querying such a collection should have worked at runtime. However, the result type was broader because we did not consider the projection definition when computing the result type. This issue would have existed regardless of whether we added the constraint you removed in this PR.

So I don't believe there was ever a reason to add the constraint that the projection definition must match across different entities in a collection.

Let me know if I'm wrong

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.

2 participants