python - How to create mongoengine filter query from fields listed as string rather DocumentFields -
i trying write function can take filter query string , later want parse , create respective filter query used in mongoengine. tried using q() not working string.
working:
return q(id__istartswith=value)
not working:
_query = 'id__istartswith=' + value return q(_query)
any highly appreciated.
you can use keyword expansion.
_query = {'id__istartswith': value} return q(**_query)
Comments
Post a Comment