Passing more query to raw_query
Alir3z4 opened this issue · 0 comments
Alir3z4 commented
raw_query
is fine to pass a query as spec
to it, but noting there for fields or other.
Like:
CoolModel.objects.raw_query({age : {'$gt': 13}})
but if we need to have fields or for example having score
as $meta
field on the result when doing full-text search it won't work at all, since passing fields
to pymongo
find
should be second parameter and can't be combined with the spec
.
I know defining extra field on the result would cause failure in returning QuerySet
since the model we're running query on it doesn't have that new field that has been defined by $meta
, but is it the only reason to not able pass extra parameters to raw_query
? because it can be done via defining a proxy
model where we can have any $meta field defined on it.