mongoengine
mongoengine copied to clipboard
Multiple OR operator not showing all results
I have a DB with the following data:
{"language": "es", "schema": "6", "title": "Jaén 1"} {"language": "es", "schema": "6", "title": "Málaga 1"} {"language": "es", "schema": "6", "title": "Málaga 2"} {"language": "es", "schema": "6", "title": "Málaga 3"}
And this is the code:
q = Q(title__icontains="Málaga") | Q(title__icontains="Malaga") | \
Q(title__icontains="Jaén") | Q(title__icontains="Jaen")
results = Entry.objects.filter(language="es", schema="6")
results = results.filter(q)
However when I run it I only get the following result: {"language": "es", "schema": "6", "title": "Jaén 1"}
I should be getting all the data I mentioned at the begining. Is this a bug in Mongoengine?
Thanks.