SHARE
TWEET

Untitled

a guest Aug 14th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let resolvers = {
  2.         Query: {
  3.             user: async (parent, { name }, context, info) => {
  4.                 return await context.db.models.User.findOne({name: name}).lean().populate('followers').exec();
  5.             },
  6.             allUsers: async (parent, args, context, info) => {
  7.                 return await context.db.models.User.find({}).lean().exec();
  8.             }
  9.         },
  10.         Mutation: {
  11.             createUser: async (parent, { name, age }, context, info) => {
  12.                 return await context.db.models.User.create({name, age});
  13.             }
  14.         }
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top