I've got a problem. I'm creating a question to MongoDB:
const team: TeamDocument = await Team.findOne({ members: payload.id, name })
The problem is, members is an array of objects:
members: [{
name: { type: Schema.Types.ObjectId, ref: 'User' },
role: String
}]
So when I create ask, it showes an error:
UnhandledPromiseRejectionWarning: ObjectParameterError: Parameter "obj" to Document() must be an object, got 5e88984b1478de32f43289e8
How can I repair this, so it will check if the members array has an object which contains an id provided in payload?