GraphQLGuide / apollo-datasource-mongodb

Apollo data source for MongoDB
MIT License
285 stars 64 forks source link

Fixed unintended union distribution #55

Closed Idono87 closed 3 years ago

Idono87 commented 3 years ago

Fixed issue where a union of document models would be distributed as a union of collections instead of a collection with a union of document models. As a side effect, the old type did not allow multiple document types to be inserted, updated or retrieved.

Expected behavior should be as follows:

interface A { ... }
interface B { ... }
interface C { ... }

type ExpectedType = Collection<A | B | C>
// MongoCollection<A | B | C>

Old behavior causes the type to be distributed as:

interface A { ... }
interface B { ... }
interface C { ... }

type OldType = Collection<A | B | C>
// MongoCollection<A> | MongoCollection<B> | MongoCollection<C>
lorensr commented 3 years ago

Thanks! Released in v0.3.2