Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update embedded Document #12

Open
vincent41 opened this issue Dec 17, 2018 · 0 comments
Open

Update embedded Document #12

vincent41 opened this issue Dec 17, 2018 · 0 comments

Comments

@vincent41
Copy link

Thanks for a great cheat. I'm looking for update embedded documents, but i can't find it anywhere. For example GraphQL query:

mutation (_id: "12" input: { work: "911" } ) { phone{ work privat } }

And hier is the problem, If I only want to change one field, another field will be deleted

schema:

type User implements Entity {
   _id: ID
    phone: PhoneType 
}

type PhoneType {
   wokr: String
   privat: String
}
type Mutation {
update(_id: ID input: PhoneInput ): User
}

resolver

Mutation: {
 update: async (_, { _id, input }) => {
            const user = await User.findOneAndUpdate({ _id: _id }, { $set: input }, { new: true })
            return user
        }
} 

HELP PLEASE

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

No branches or pull requests

1 participant