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

Features: createMany, mutation for an existing array

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

Description

hello~

Do we have plan to add createMany, and recordIds returns the array of ObjectIDs, records returns the updated objects.

```javascript
//createMany
var array = [{ name: 'Star Wars' }, { name: 'The Empire Strikes Back' }];
Movies.insertMany(array, function(error, docs) {});
```

Could we support mutation for updating an array field if I pass an ObjectId that adding to the existing array instead of overwrite, the overwrite only happens if I pass an array of ObjectId?

The first mutation for phones and returns two values for phones being "111-222-333-444", "444-555-666-777".

```javascript
mutation {
userCreate(record: {
contacts: {
phones: [
"111-222-333-444",
"444-555-666-777"
]
},
}) {
recordId
record {
contacts {
email
phones
}
}
}
}

{
"data": {
"userCreate": {
"recordId": "593ca1149f15dd003778ba1f",
"record": {
"contacts": {
"email": null,
"phones": [
"111-222-333-444",
"444-555-666-777"
]
}
}
}
}
}
```

The second mutation for phones, the expected returns are three values for phones being "111-222-333-444", "444-555-666-777", "444-555-666-888" instead of "444-555-666-888".

```javascript
mutation {
userCreate(record: {
contacts: {
phones: "444-555-666-888"
},
}) {
recordId
record {
contacts {
email
phones
}
}
}
}

{
"data": {
"userCreate": {
"recordId": "593ca1149f15dd003778ba1f",
"record": {
"contacts": {
"email": null,
"phones": [
"111-222-333-444",
"444-555-666-777",
"444-555-666-888"
]
}
}
}
}
}
```

thanks,
anderson

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.