Getting data from geoseptical points and matching

i am using this query

userModel.find({
                categories: {
                    $elemMatch: {
                        activestatus: 'active',
                        category: inquiryObject.category,
                        answers: { $elemMatch: { question: {$in:questions}, answers: {$in:answers} }},
                        location:{$near:{
                          $geometry: {
                              type: "Point",
                              coordinates: [inquiryObject.location.coordinates[0], inquiryObject.location.coordinates[1]]
                          },
                          $maxDistance:'categories.servingradius',
                        }}
                      }
                    },
                  })

now categories is array and in categories there is every object have servingradius i want to find the user whitch have that category and question answers within the user’s serving raduis how can i do that

Hello @Muhammad_Hasnat_Shabir ,

Welcome to The MongoDB Community Forums! :wave:

Could you please provide additional details for us to understand your use-case better?

  • MongoDB Version
  • Some sample documents
  • Expected Output documents
  • Output explanation according to sample documents and expected output documents

Regards,
Tarun