Closed josejachuf closed 1 year ago
This work:
where = { last_name: { $ilike: '%' + params.filter + '%' } }
the % were missing, but with $or not works:
where = {
$or: [
{
// id: params.filter,
last_name: { $ilike: '%' + params.filter + '%' },
first_name: { $ilike: '%' + params.filter + '%' }
}
]
}
@josejachuf the list argument of $or
should contain the objects of the conditions:
where = {
$or: [
{last_name: { $ilike: '%' + params.filter + '%' }},
{first_name: { $ilike: '%' + params.filter + '%' }}
]
}
while you put a single object, so a single AND condition.
Also, you probably want to swtich from $ilike
to $icontains
.
Thanks, works fine!!
Hi @gi0baro I am trying to use where with $or and $and but it doesn't work as I hope
in javascript I have:
With this I get, for example:
{"$or":[{"last_name":{"$ilike":"Fue"},"first_name":{"$ilike":"Fue"}}]}
then:
http://a.com/api/user?page=1&page_size=20&sort_by=-id&where={"$or":[{"last_name":{"$ilike":"F"},"first_name":{"$ilike":"F"}}]}
but not returns data
What am I doing wrong? Jose