title: How to I resolve below graphql query in mongodb nested array
body: <p>my model schema look like this</p>
  <pre><code>const mongoose = require(&quot;mongoose&quot;)
  const userSchema = new mongoose.Schema(
    {
      username: {
        type: String,
        required: true,
      },
      password: {
        type: String,
        required: true,
        select: false,
      },
      email: {
        type: String,
        required: true,
        unique: true,
        match: [
          /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/,
          &quot;Please enter a valid email&quot;,
        ],
      },
      followers:[
        {
          type:mongoose.Schema.Types.ObjectId,
          ref:&quot;user&quot;
        }
      ],
      following:[
        {
          type:mongoose.Schema.Types.ObjectId,
          ref:&quot;user&quot;
        }
      ],
      displayName: {
        type: String,
        required: false,
      },
    },
    { timestamps: true }
  )
  
  module.exports = mongoose.model(&quot;user&quot;, userSchema)
  </code></pre>
  <p>in this schema all working good like mutation work fine but when i fetch query of all user then in that query followers and following field return null like bellow image
  <a href="https://i.stack.imgur.com/mYNvV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mYNvV.jpg" alt="enter image description here" /></a></p>
  <p>and my graphql query is</p>
  <pre><code>const users = {
    type: new GraphQLList(UserType),
    description: &quot;Retrieves list of users&quot;,
    resolve(parent, args) {
      return User.find()
    },
  }
  </code></pre>
  <p>and typedef is</p>
  <pre><code> const UserType = new GraphQLObjectType({
      name: &quot;User&quot;,
      description: &quot;User types&quot;,
      fields: () =&gt; ({
        id: { type: GraphQLID },
        username: { type: GraphQLString },
        email: { type: GraphQLString },
        post:{
          type: GraphQLList(PostType),
          resolve(parent, args) {
            return Post.find({ authorId: parent.id })
          },
        },
        savePost:{
          type:GraphQLList(savedPosts1),
          resolve(parent, args) {
            return SavePost.findById({ authorId: parent.id })
          },
        },
        followers:{
          type:GraphQLList(UserType),
        },
        following:{
          type:GraphQLList(UserType)
        }
        // displayName: { type: GraphQLString },
      }),
    })
  </code></pre>
  <p>so please tell me how to i resolve that followers and following query in graphql with mongodb and tell me what i write in my userType typedef</p>