How to find an array and a value for a field in mongoose?

Viewed 9

Is there a way to query find two values for a field? One value is an user id and the other value is an array of users id (fusers).

First of all, I tried to do this:

PostModel.find({user: {$in: [req.user.id, fusers]}}).exec();

But I get this error instead:

CastError: Cast to ObjectId failed for value
...
(type Array) at path "user" for model "posts" 
0 Answers
Related