My graphQl query find returns null response on GraphQL Playground but on console there is array of find data

Viewed 112
query GetJourneys {
 getJourneyById(userId: "61dcc7de6d06a5db38d7b6e0"){
  id
  city
  trip
  tripName
  duration
  userId
}
}

So when I run this query and my resolver has const journey = await Journey.find({ userId: userId }); it returns null in all fields

instead when I do it as findOne there is correct response but only 1 object comes like this

  {
    _id: 61de5fb2130167512ed537dc,
    city: 'Indonesia Convention Exhibition (ICE) BSD City',
    trip: 0,
    tripName: 'Indonesia Trip',
    duration: 1,
    url: 'http://www.ice-indonesia.com/',
    userId: '61dcc7de6d06a5db38d7b6e0',
    cityId: 'ChIJBSMVX1P7aS4RePSYsNhuQDQ',
    __v: 0
  }
]

Only on GraphQL playground data returns as null what can be the reason?

0 Answers
Related