I'm learning MongoAlchemy, a layer on top of Python driver for MongoDB. Let's say there is a Python class, mapped from a MongoDB object like this:
from mongoalchemy.document import Document
from mongoalchemy.fields import *
class Person(Document):
name = StringField()
And i query the database like this:
for person in query.filter(Person.name == 'Geronimo'):
print person
It works fine, but now then i want to query the database for case insensitive name (both "geronimo" and "Geronimo"), or to find all names having two o's in them. query.filter(Person.name[1:] == 'eronimo')
and such do not work, as Person.name is not a string, but a QueryField object.
How do i do such complex queries in MongoAlchemy?