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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With