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

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -