I am accessing mongodb through parsepy in my django application. I have a name field in my db collection. I'm trying to get those name fields which match my query string.
For example, if I have these values--> food, folk, form, fill, filled, dust
If I query fo I should get food, folk, form.
If I query fi I should get fill, filled
I found that CollectionName.Query.filter(name__startswith=query)
could do that. But unfortunately that is giving me empty queryset.
I tried it with CollectionName.Query.filter(name=ExactNameInDB)
like CollectionName.Query.filter(name='food')
and it returned me the collection object with that name as the queryset.
I even tried name__contains
as keyword argument but that didn't work. This one is bugging me since a long time. Please help me. If you think that this explanation isn't enough, I can elaborate the context more.