I'm using MongoDB adapter of Juggling-DB.
How can I run the equivalent of the following SQL query (IDs are fake)
SELECT * FROM APPS
WHERE
active = 1
AND (
user_id = '12345'
OR
id IN ('456', '789', '012')
)
that is "active apps that either belong to the given user or are available to all".
I tried the following:
{
where: {
active: true,
or: [
{
user_id: '12345'
},
{
_id: {
in: ['456', '789', '012']
}
}
]
}
}
But it returns nothing. Looking at the source code my wild guess is that it only converts strings to MongoDB.ObjectID
when _id
is a single string, not an array.