Python Eve contains filter

eve, flask, python, rest

Solution

You could use mongodb `$regex` operator, which is blacklisted by default in Eve (`MONGO_QUERY_BLACKLIST = ['$where', '$regex']`).

Add `MONGO_QUERY_BLACKLIST = ['$where']` to your `settings.py`. Then you can query your API like this:

`?where={"name": {"$regex": ".*foo.*"}}`.

Be careful however. If you don't control the client, enabling regexes could potentially increase your API vulnerability.

Problem

There's some way to return items that field contains some value? Eg. `GET /people?contains="foo"` Return all persons that have the word 'foo' in the name. Thanks in advance

Original source