Loopback where filter on an array type field

Viewed 6019

I'm working on a loopback project, I have a model called Depot which has a field likersList, that fiels is an array of string (user id)
I want to find all Depots which has not a specific userId in it's likersList , I tried that filter, but it doesn't work

let userId=req.accessToken.userId;
let filter={
   where:{
       and:[
           ....
           {likersList:{nin:[userId]}}
       ]
   }
   ....
}

I also try that {likerList:{neq:userId}} , doesn't work too
But if try this likersList:userId that returns all Depots which has userIdin it's likersList , so I expected that doing {likerList:{neq:userId}} sould do a opposite

All I want is to know how to check if a field (array type) contains a certain value

Help please !

2 Answers
Related