graphql-compose / graphql-compose/graphql-compose-mongoose

Add relation to nested ObjectID array

Open
#350 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

I have a Schema as follows:

```javascript
export const ProductSchema = new Schema(
{
colours: {
type: [
{
colour: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Colour',
},
price: { type: String },
},
],
required: false,
}
},
{
collection: 'products',
}
);
```

I am trying to use the `addRelation` function to populate the colour object inside each array item, however because it's within a nested array (not an object) I'm struggling to make it work.

Am I missing something?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.